peoplecalllog.luac.lua
来自「htc manila 2 sourcecode」· LUA 代码 · 共 383 行
LUA
383 行
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;;;10;0,16,37;;0,0,0,2,42;0,10,15;;0,0,0,106;0,6;;;0,0,0,0,0,5,16;0,0,1;;0,0,0,2,3,4;0,0,0,11,15,17,29,89,90,91,105;0,4,8,12;0,4,8,12;3;0,1;0,1; 771fb99e_manila.luac
require("contacts_database_svc")
require("transitions")
require("ScrollPhysics")
require("theme")
require("MyFaves_manager_v1_5_svc")
require("machine_status_svc")
CallLogObject = class()
LvCallLog = class()
MyFavesUtilityObj = nil
g_IsMyFavesContact = false
machineStatus = nil
main = function()
objs3D = {}
objs3D[1] = Camera3D
objs2D = {}
objs2D[1] = ContactInfoGroup
IsTesting = false
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), LSKFunction_Callback))
_application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), RSKFunction_Callback))
machineStatus = MachineStatus()
machineStatus.TwentyFourHourTime.OnValueChanged:connect(HandleTimeChange)
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
trace("[peopleCallLog] : EnableLandscape")
require("people\\peopleCallLog_Landscape")
peopleCallLog_Landscape = peopleCallLog_ScreenRotation(SetListViewLayout)
end
MyFavesUtilityObj = MyFavesUtility()
objCallLogs = CallLogObject(CallLogListView, not machineStatus.CurrentTime.Value.IsTwentyFourHour)
end
RSKFunction_Callback = function()
dialogThing = _application.DialogManager:GetDialog(URL("Manila://PeopleCallLog.dialog"))
dialogThing.OnExit:connect(DialogMenu_Callback)
dialogThing:Show()
end
LSKFunction_Callback = function()
BackToRreviousPage()
end
BackToRreviousPage = function()
_application.Navigation:NavigateBack()
local l_4_0 = _application.Store:GetIntValue(Lifetime_Application, "People.PeopleDetail.LaunchVia")
trace("launchFromManila=" .. tostring(l_4_0))
if l_4_0 ~= nil and l_4_0 ~= 0 then
Shell_GoBackToLaunchingApplication()
end
end
DialogMenu_Callback = function(l_5_0)
l_5_0.OnExit:disconnect(DialogMenu_Callback)
if l_5_0.Result.ExitType ~= DialogExitType_Cancel and l_5_0.Result.UserValue == "Delete All" then
local l_5_1 = URL("Manila://Confirmation.dialog")
l_5_1.Parameters:AddParameter("Title", Locale:GetString("IDS_DELETE_ALL_DLG_TITLE"))
l_5_1.Parameters:AddParameter("ContentString", Locale:GetString("IDS_DELETE_ALL_DLG_MSG"))
local l_5_2 = _application.DialogManager:GetDialog(l_5_1)
l_5_2.OnExit:connect(DialogMenuOptions_Callback)
l_5_2:Show()
end
end
DialogMenuOptions_Callback = function(l_6_0)
l_6_0.OnExit:disconnect(DialogMenuOptions_Callback)
if l_6_0.Result.ExitType ~= DialogExitType_Cancel then
trace("############# delete all calllog ")
objCallLogs.PIDatabase:DeleteAllCallLogs()
end
end
SetContactPictuure = function(l_7_0, l_7_1, l_7_2)
local l_7_3 = l_7_0:GetContactType()
trace("GetContactType " .. tostring(l_7_3))
if l_7_3 == 1 then
l_7_1:SetTextureRef("ContactTypeSIM")
l_7_1.TextureCoords:set(0.046875, 0.046875, 0.5546875, 0.5546875)
l_7_1._visible = true
elseif l_7_3 == -1 then
l_7_1:SetTextureRef("PeoplePlaceholder")
l_7_1.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
l_7_1._visible = true
elseif l_7_0 == nil then
else
local l_7_4 = l_7_0:GetPersonPicture()
if g_IsMyFavesContact == true and MyFavesUtilityObj:IsCircleStyle() and l_7_4 ~= nil and l_7_4:HasValue() then
l_7_1._visible = false
ContactPhotoFrame._visible = false
MyFavesContactPhoto._visible = true
MyFavesBaseImage:SetTexture(l_7_4:GetValue().Texture)
MyFavesBaseImage.TextureCoords.value = l_7_4:GetValue().UV
else
if l_7_4:HasValue() and l_7_1:SetTexture(l_7_4:GetValue().Texture) then
l_7_1.TextureCoords.value = l_7_4:GetValue().UV
l_7_1._visible = true
elseif l_7_2 == true then
l_7_1:SetTextureRef("PeoplePlaceholder")
l_7_1.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
l_7_1._visible = true
else
l_7_1._visible = false
end
end
end
end
HandleItemSelection = function(l_8_0)
trace("@@@@@@ HandleItemSelection")
if l_8_0 >= 0 then
local l_8_1 = objCallLogs.logs:GetItem(l_8_0)
local l_8_2 = objCallLogs.PIDatabase:GetCallLogInfoInstance(l_8_1)
Shell_MakeAPhoneCall(l_8_2:GetCallerId(), ContactDisplayName.String)
end
end
SetListViewLayout = function()
if objCallLogs ~= nil and peopleCallLog_Landscape ~= nil then
local gg = CallLogListView:GetGenerator()
if gg ~= nil then
for i = 0, gg:GetCount() - 1 do
local item = gg:GetItem(i)
local gcl = objCallLogs.PIDatabase:GetCallLogInfoInstance(gg:GetData(i))
if item ~= nil then
local ns = item.Namespace
peopleCallLog_Landscape:ResetListviewItemLayout(item, gcl, ns:FindName("CallLogTime"), ns:FindName("CallLogDate"))
end
end
end
end
end
CallLogObject.__init = function(l_10_0, l_10_1, l_10_2)
_request.NavigateOutTo:connect(l_10_0.OnNavigateOut, l_10_0)
_request.NavigateInFrom:connect(l_10_0.OnNavigateIn, l_10_0)
l_10_0.ShowAMPM = l_10_2
if IsTesting then
FakeData = {}
FakeData[0] = {Type = 0, Time = "10:21am", Number = "0917-682-495 (m)", Duration = "0:05"}
FakeData[1] = {Type = 1, Time = "5/06", Number = "02-9813-5837 (w)", Duration = "1:35"}
FakeData[2] = {Type = 2, Time = "5/02", Number = "02-9813-5837 (w)", Duration = "0:25"}
FakeData[3] = {Type = 2, Time = "5/01", Number = "0917-682-495 (m)", Duration = "0:13"}
l_10_0.LogCollection = VectorNotifyint()
for i = 0, 3 do
l_10_0.LogCollection:push_back(i)
end
else
l_10_0.PE = PeopleEngine_Instance()
l_10_0.PI = PersonInfo()
l_10_0.PE:GetPersonInfo(l_10_0.PI)
l_10_0.PIDatabase = PersonInfoDatabase(l_10_0.PI, PersonInfo_CALLLOG)
l_10_0.logs = l_10_0.PIDatabase:Select(nil, nil)
end
if MyFavesUtilityObj:IsMyFavesTurnOn() then
g_IsMyFavesContact = MyFavesUtilityObj:IsMyFavesContactyIDForLua(l_10_0.PI:GetIDForLua())
if g_IsMyFavesContact == true then
trace("Is MyFaves contact")
MyFavesUtilityObj:DismissMy5MissedCall(l_10_0.PI:GetIDForLua())
end
end
local l_10_3 = l_10_0.PI:GetContactType()
if l_10_3 == -1 then
ContactDisplayName.String = l_10_0.PI:GetUnknownPhoneNumber()
else
ContactDisplayName.String = l_10_0.PI:GetName()
end
SetContactPictuure(l_10_0.PI, ContactPhoto, true)
l_10_0.LvCallLogs = LvCallLog(CallLogListView, l_10_0.logs, l_10_0.PI, l_10_0.PIDatabase)
end
CallLogObject.ResetDateTimeFormate = function(l_11_0)
trace("ResetDateTimeFormate")
local l_11_1 = CallLogListView:GetGenerator()
if l_11_1 ~= nil then
local l_11_2 = l_11_1:GetCount() - 1
local l_11_3 = nil
local l_11_4 = nil
local l_11_5 = nil
for i = 0, l_11_2 do
l_11_3 = l_11_1:GetItem(i)
if l_11_3 ~= nil then
local item = l_11_0.logs:GetItem(i)
local pid = l_11_0.PIDatabase:GetCallLogInfoInstance(item)
local t = pid:GetStartTime():ToLocal()
l_11_4 = l_11_3.Namespace:FindName("CallLogTime")
l_11_4.String = GetFormatTime(t)
l_11_5 = l_11_3.Namespace:FindName("CallLogDate")
l_11_5.String = GetFormatDate(t)
end
end
end
trace("ResetDateTimeFormate end")
end
CallLogObject.OnNavigateOut = function(l_12_0, l_12_1)
machineStatus.TwentyFourHourTime.OnValueChanged:disconnect(HandleTimeChange)
machineStatus = nil
_request.NavigateOutTo:disconnect(l_12_0.OnNavigateOut, l_12_0)
_application:EnableVelocityEngine(true)
Transition(l_12_1, "Out")
end
CallLogObject.OnNavigateIn = function(l_13_0, l_13_1)
_request.NavigateInFrom:disconnect(l_13_0.OnNavigateIn, l_13_0)
Transition(l_13_1, "In")
_application:EnableVelocityEngine(false)
end
LvCallLog.__init = function(l_14_0, l_14_1, l_14_2, l_14_3, l_14_4)
l_14_0.PI = l_14_3
l_14_0.collection = l_14_2
l_14_0.PIDB = l_14_4
local l_14_5 = TileLayout()
l_14_5:SetItemSize(480, 80, 0)
l_14_5.SelectionNode = Selector
l_14_1:SetLayout(l_14_5)
local l_14_6 = nil
if IsTesting then
l_14_6 = LibraryGeneratorint(LogCollection, l_14_1:GetMovie(), l_14_1.ComponentLibraryName, l_14_1.ComponentLibraryID)
l_14_6.ItemCreated:connect(l_14_0.Fake_HandleItemCreated, l_14_0)
else
l_14_6 = LibraryGeneratorPersonInfoBase(l_14_2, l_14_1:GetMovie(), l_14_1.ComponentLibraryName, l_14_1.ComponentLibraryID)
l_14_6.ItemCreated:connect(l_14_0.HandleItemCreated, l_14_0)
end
l_14_6.ItemDestroyed:connect(l_14_0.HandleItemDestroyed, l_14_0)
l_14_6.SelectedIndexChanged:connect(l_14_0.OnSelectedIndexChanged, l_14_0)
l_14_6.RecycleItems = true
l_14_1:SetGenerator(l_14_6)
l_14_1:ForceLayout()
ListPhysics = ScrollPhysics(l_14_1, l_14_1, HandleItemSelection)
ListPhysics:ConnectMouseEvents()
l_14_1:Focus()
end
LvCallLog.HandleItemDestroyed = function(l_15_0, l_15_1)
local l_15_2 = l_15_1.Namespace
l_15_2:FindName("ListIcon")._visible = false
l_15_2:FindName("CallLogNumber")._visible = false
l_15_2:FindName("CallLogDuration")._visible = false
l_15_2:FindName("CallLogTime")._visible = false
l_15_2:FindName("CallLogDate")._visible = false
l_15_1.OnSelected:disconnect(HandleItemSelected)
l_15_1.OnDeselected:disconnect(HandleItemDeselected)
end
LvCallLog.OnSelectedIndexChanged = function(l_16_0, l_16_1, l_16_2)
end
LvCallLog.Fake_HandleItemCreated = function(l_17_0, l_17_1, l_17_2)
local l_17_3 = FakeData[l_17_1]
local l_17_4 = l_17_2.Namespace
local l_17_5 = l_17_3.Type
if l_17_5 == 0 then
l_17_4:FindName("ListIcon"):SetTextureRef("Call-history-Icon_Out")
elseif l_17_5 == 1 then
l_17_4:FindName("ListIcon"):SetTextureRef("Call-history-Icon_Out")
elseif l_17_5 == 2 then
l_17_4:FindName("ListIcon"):SetTextureRef("Call-history-Icon_Out")
end
l_17_4:FindName("CallLogNumber").String = l_17_3.Number
l_17_4:FindName("CallLogDuration").String = Locale:GetString("IDS_DURATION") .. ": " .. l_17_3.Duration
l_17_4:FindName("CallLogTime").String = l_17_3.Time
end
LvCallLog.HandleItemCreated = function(l_18_0, l_18_1, l_18_2)
trace("=====================item created")
trace("@@@@@@ DATA = " .. tostring(l_18_1))
local l_18_3 = l_18_2.Namespace
local l_18_4 = l_18_0.PIDB:GetCallLogInfoInstance(l_18_1)
local l_18_5 = l_18_4:GetStatus()
trace("@@@@@@ LOG TYPE = " .. tostring(l_18_5))
if l_18_5 == 2 then
l_18_3:FindName("ListIcon"):SetTextureRef("Call-history-Icon_Miss")
elseif l_18_5 == 1 then
l_18_3:FindName("ListIcon"):SetTextureRef("Call-history-Icon_Out")
elseif l_18_5 == 0 then
l_18_3:FindName("ListIcon"):SetTextureRef("Call-history-Icon_In")
end
l_18_3:FindName("ListIcon")._visible = true
l_18_3:FindName("CallLogNumber").String = l_18_4:GetCallerId() .. " " .. l_18_0.PI:GetPhoneTypeByNumber(l_18_4:GetCallerId())
l_18_3:FindName("CallLogNumber")._visible = true
trace("@@@@@@ PHONE TYPE = " .. tostring(l_18_0.PI:GetPhoneTypeByNumber(l_18_4:GetCallerId())))
local l_18_6 = l_18_4:GetStartTime():ToLocal()
local l_18_7 = l_18_3:FindName("CallLogTime")
l_18_7.String = GetFormatTime(l_18_6)
l_18_7._visible = true
local l_18_8 = l_18_3:FindName("CallLogDate")
l_18_8.String = GetFormatDate(l_18_6)
l_18_8._visible = true
local l_18_9 = l_18_4:GetDuration()
local l_18_10 = ""
if l_18_9 < 10 then
l_18_10 = "Duration: 0:0" .. l_18_9
elseif l_18_9 < 60 then
l_18_10 = "Duration: 0:" .. l_18_9
elseif l_18_9 < 3600 then
if l_18_9 % 60 < 10 then
l_18_10 = "Duration: " .. tostring(math.floor(l_18_9 / 60)) .. ":0" .. tostring(l_18_9 % 60)
else
l_18_10 = "Duration: " .. tostring(math.floor(l_18_9 / 60)) .. ":" .. tostring(l_18_9 % 60)
end
else
l_18_10 = ""
end
l_18_3:FindName("CallLogDuration").String = l_18_10
l_18_3:FindName("CallLogDuration")._visible = true
if peopleCallLog_Landscape ~= nil then
peopleCallLog_Landscape:ResetListviewItemLayout(l_18_2, l_18_4, l_18_7, l_18_8)
end
l_18_2.OnSelected:connect(HandleItemSelected)
l_18_2.OnDeselected:connect(HandleItemDeselected)
end
HandleItemSelected = function(l_19_0)
local l_19_1 = l_19_0.Namespace:FindName("CallLogNumber")
local l_19_2 = l_19_0.Namespace:FindName("CallLogDuration")
local l_19_3 = l_19_0.Namespace:FindName("CallLogDate")
local l_19_4 = l_19_0.Namespace:FindName("CallLogTime")
if l_19_1 ~= nil then
l_19_1.Color = GetMainTextSelectedColor()
end
if l_19_2 ~= nil then
l_19_2.Color = GetSubTextSelectedColor()
end
if l_19_3 ~= nil then
l_19_3.Color = GetSubTextSelectedColor()
end
if l_19_4 ~= nil then
l_19_4.Color = GetSubTextSelectedColor()
end
end
HandleItemDeselected = function(l_20_0)
local l_20_1 = l_20_0.Namespace:FindName("CallLogNumber")
local l_20_2 = l_20_0.Namespace:FindName("CallLogDuration")
local l_20_3 = l_20_0.Namespace:FindName("CallLogDate")
local l_20_4 = l_20_0.Namespace:FindName("CallLogTime")
if l_20_1 ~= nil then
l_20_1.Color = GetMainTextUnselectedColor()
end
if l_20_2 ~= nil then
l_20_2.Color = Color(130, 130, 130, 255)
end
if l_20_3 ~= nil then
l_20_3.Color = Color(102, 102, 102, 255)
end
if l_20_4 ~= nil then
l_20_4.Color = GetAlarmOffColor()
end
end
HandleTimeChange = function()
local l_21_0 = machineStatus.CurrentTime.Value
if objCallLogs.ShowAMPM == l_21_0.IsTwentyFourHour then
objCallLogs.ShowAMPM = not l_21_0.IsTwentyFourHour
objCallLogs:ResetDateTimeFormate()
end
trace("HandleTimeChange end")
end
GetFormatTime = function(l_22_0)
local l_22_1 = ""
if machineStatus.CurrentTime.Value.IsTwentyFourHour then
l_22_1 = l_22_0:GetTimeString(TimeFormatOptions_Default)
else
l_22_1 = l_22_0:GetTimeString(TimeFormatOptions_ExcludeTimeMarker) .. l_22_0:GetTimeString("tt")
end
return l_22_1
end
GetFormatDate = function(l_23_0)
local l_23_1 = ""
if l_23_0:IsToday() then
l_23_1 = Locale:GetString("IDS_TODAY")
else
l_23_1 = l_23_0:GetDateString(DateFormatOptions_Default)
end
return l_23_1
end
main()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?