peoplecallhistoryglobal.luac.lua

来自「htc manila 2 sourcecode」· LUA 代码 · 共 560 行 · 第 1/2 页

LUA
560
字号
      l_19_2._visible = true
      l_19_3._visible = true
      if not IsScrolling() then
         trace("not Scrolling")
         l_19_1.Tag.Pic = PeopleImageLoader(AsyncPicLoader_CreateInstance(PicLoader), l_19_2, l_19_13)
      end
   else
      trace("unknown")
      l_19_2:SetTextureRef("PeoplePlaceholderSmall")
      l_19_2.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
      l_19_2._visible = true
      l_19_3._visible = true
   end
   l_19_5.String = l_19_11:GetCallerId() .. " " .. l_19_11:GetCallType()
   l_19_5._visible = true
   if l_19_11:GetStatus() == 0 then
      l_19_8:SetTextureRef("icon_incomingCall")
   else
      if l_19_11:GetStatus() == 1 then
         l_19_8:SetTextureRef("icon_outgoingCall")
      else
         if l_19_11:GetStatus() == 2 then
            l_19_8:SetTextureRef("icon_missedCall")
         end
      end
   end
   l_19_8.TextureCoords:set(0, 0, 0.546875, 0.546875)
   l_19_8._visible = true
   local l_19_15 = l_19_11:GetStartTime():ToLocal()
   if l_19_15:IsToday() then
      l_19_9.String = GetFormatTime(l_19_15)
   else
      l_19_9.String = GetFormatDate(l_19_15)
   end
   l_19_9._visible = true
   l_19_7._visible = flase
   l_19_1.OnSelected:connect(ItemSelectedFunc)
   l_19_1.OnDeselected:connect(ItemDeselectedFunc)
   l_19_1.Focusable = true
   if peopleCallHistory_Landscape ~= nil then
      peopleCallHistory_Landscape:AdjustListviewItemLayout(l_19_11, l_19_1)
   end
end

SetContactPicture = function(l_20_0, l_20_1, l_20_2)
   trace("[PeopleAllGlobal] SetContactPicture")
   if not l_20_0:HasValue() then
      l_20_1:SetTextureRef("PeoplePlaceholder")
      l_20_1.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
      l_20_1._visible = true
   else
      l_20_1:SetTexture(l_20_0:GetValue().Texture)
      l_20_1.TextureCoords.value = l_20_0:GetValue().UV
      l_20_1._visible = true
   end
end

HandleItemDestroyed = function(l_21_0)
   local l_21_1 = l_21_0.Namespace:FindName("HeaderIcon")
   local l_21_2 = l_21_0.Namespace:FindName("PhotoFrame")
   local l_21_3 = l_21_0.Namespace:FindName("ContactName")
   local l_21_4 = l_21_0.Namespace:FindName("Number")
   local l_21_5 = l_21_0.Namespace:FindName("FacebookMessage")
   local l_21_6 = l_21_0.Namespace:FindName("BubbleIcon")
   local l_21_7 = l_21_0.Namespace:FindName("DirectionIcon")
   local l_21_8 = l_21_0.Namespace:FindName("Time")
   l_21_1._visible = false
   l_21_2._visible = false
   l_21_3._visible = false
   l_21_4._visible = false
   l_21_5._visible = false
   l_21_6._visible = false
   l_21_7._visible = false
   l_21_8._visible = false
   if l_21_0.Tag ~= nil then
      if l_21_0.Tag.Pic ~= nil then
         local l_21_9 = l_21_0.Tag.Pic        
         l_21_9.Loader:Cancel()
         l_21_9.Loader = nil
         l_21_0.Tag.Pic = nil
      end
      if l_21_0.Tag.Oid ~= nil then
         l_21_0.Tag.Oid = nil
      end
      l_21_0.Tag = nil
   end
   l_21_0.OnSelected:disconnect(ItemSelectedFunc)
   l_21_0.OnDeselected:disconnect(ItemDeselectedFunc)
end

OnSelectedIndexChanged = function(l_22_0, l_22_1)
end

HandleItemSelection = function(l_23_0)
   if l_23_0 >= 0 then
      local l_23_1 = CallLog:GetItem(l_23_0)
      local l_23_2 = PIDatabase:GetCallLogInfoInstance(l_23_1)
      if l_23_2:SaveOidInApplicationStore() then      
        if l_23_2:GetContactTypeByPhoneNumber() == 0 then
           _application.Navigation:Navigate(URL("Manila://PeopleDetail/peopleCallLog.page"), true)
        else
           _application.Navigation:Navigate(URL("Manila://PeopleDetail_SIM/peopleCallLog.page"), true)
        end
      end
    else
    end
end

HandleCallLogCollectionReset = function()
   trace("[PeopleCallHistoryGlobal] HandleCallLogCollectionReset")
   CallLog = PIDatabase:Select(nil, nil)
   CreateListView()
end

CreatePeopleInfo = function()
   trace("[PeopleCallHistoryGlobal] CreatePeopleInfo ")
   machineStatus = MachineStatus()
   machineStatus.TwentyFourHourTime.OnValueChanged:connect(HandleTimeChange)
   if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
      trace("[peopleCallHistory] : EnableLandscape")
      require("people\\peopleCallHistory_Landscape")
      peopleCallHistory_Landscape = peopleCallHistory_ScreenRotation(Camera2D, Camera3D)
   end
   ItemListLayout = TileLayout()
   ItemListLayout:SetItemSize(screenWidth, heightPeopleItem, 0)
   ItemListLayout.DisableVirtualization = false
   ItemListLayout.SelectionNode = Selector
   CallHistoryListview:SetLayout(ItemListLayout)
   objPE = PeopleEngine_Instance()
   PerInfo = PersonInfo()
   objPE:GetPeopleInfo(PerInfo)
   PIDatabase = PersonInfoDatabase(PerInfo, PersonInfo_CALLLOG_ALL)
   CallLog = PIDatabase:Select(nil, nil)
   if peopleCallHistory_Landscape ~= nil then
      peopleCallHistory_Landscape._PIDB = PIDatabase
      peopleCallHistory_Landscape._Collection = CallLog
   end
   CallLog.CollectionReset:connect(HandleCallLogCollectionReset)
   CreateListViewForAll(not machineStatus.CurrentTime.Value.IsTwentyFourHour)
end

CreateListView = function()
   trace("[PeopleCallHistoryGlobal] CreateListView, call history count = " .. CallLog:GetCount())
   local l_26_0, l_26_1 = nil, nil
   local l_26_2 = VectorNotifyint()
   ListGenerator = LibraryGeneratorint(l_26_2, CallHistoryListview:GetMovie(), CallHistoryListview.ComponentLibraryName, CallHistoryListview.ComponentLibraryID)
   ListGenerator.RecycleItems = true
   ListGenerator.ItemCreated:connect(HandleItemCreated)
   ListGenerator.ItemDestroyed:connect(HandleItemDestroyed)
   ListGenerator.SelectedIndexChanged:connect(OnSelectedIndexChanged)
   CallHistoryListview:SetGenerator(ListGenerator)
   CallHistoryListview:GetGenerator().SelectedIndex = -1
   CallHistoryListview:ForceLayout()
   if ListPhysics ~= nil then
      ListPhysics:DisconnectMouseEvents()
      ListPhysics = nil
   end
   ListPhysics = ScrollPhysics(CallHistoryListview, CallHistoryListview, HandleItemSelection)
   ListPhysics:SetBehaviorCallback(CallHistory_ListPhysicsScrollBehaviorCallback)
   for i = 0, CallLog:GetCount() - 1 do
      l_26_0 = CallLog:GetItem(i)
      l_26_1 = PIDatabase:GetCallLogInfoInstance(l_26_0)
      if CallHistoryFilter == 0 then
         l_26_2:push_back(i)
      elseif CallHistoryFilter == 1 and l_26_1:GetStatus() == 2 then
         l_26_2:push_back(i)
      elseif CallHistoryFilter == 2 and l_26_1:GetStatus() == 1 then
         l_26_2:push_back(i)
      elseif CallHistoryFilter == 3 and l_26_1:GetStatus() == 0 then
         l_26_2:push_back(i)
      end
   end
   ListPhysics:ConnectMouseEvents()
   CallHistoryListview:Focus()
   if peopleCallHistory_Landscape ~= nil then
      peopleCallHistory_Landscape._generator = ListGenerator
   end
end

IsScrolling = function()
   if ListPhysics == nil then
     return false
   end
   return ListPhysics:IsScrolling()
end

CreateListViewForAll = function(l_28_0)
   trace("[PeopleCallHistoryGlobal] CreateListViewForAll ")
   showAMPMTime = l_28_0
   local l_28_1 = VectorNotifyint()
   ListGenerator = LibraryGeneratorint(l_28_1, CallHistoryListview:GetMovie(), CallHistoryListview.ComponentLibraryName, CallHistoryListview.ComponentLibraryID)
   ListGenerator.RecycleItems = true
   ListGenerator.ItemCreated:connect(HandleItemCreated)
   ListGenerator.ItemDestroyed:connect(HandleItemDestroyed)
   ListGenerator.SelectedIndexChanged:connect(OnSelectedIndexChanged)
   CallHistoryListview:SetGenerator(ListGenerator)
   CallHistoryListview:GetGenerator().SelectedIndex = -1
   CallHistoryListview:ForceLayout()
   if ListPhysics ~= nil then
      ListPhysics:DisconnectMouseEvents()
      ListPhysics = nil
   end
   ListPhysics = ScrollPhysics(CallHistoryListview, CallHistoryListview, HandleItemSelection)
   ListPhysics:SetBehaviorCallback(CallHistory_ListPhysicsScrollBehaviorCallback)
   for i = 0, CallLog:GetCount() - 1 do
      l_28_1:push_back(i)
   end
   ListPhysics:ConnectMouseEvents()
   CallHistoryListview:Focus()
   if peopleCallHistory_Landscape ~= nil then
      peopleCallHistory_Landscape._generator = ListGenerator
   end
end

HandleTimeChange = function()
   trace("[PeopleCallHistoryGlobal] HandleTimeChange START")
   local l_29_0 = machineStatus.CurrentTime.Value
   if showAMPMTime == l_29_0.IsTwentyFourHour then
      showAMPMTime = not l_29_0.IsTwentyFourHour
      ResetCallHistoryDateTimeFormat()
   end
   trace("[PeopleCallHistoryGlobal] HandleTimeChange END")
end

ResetCallHistoryDateTimeFormat = function()
   trace("[PeopleCallHistoryGlobal] ResetCallHistoryDateTimeFormat START")
   local l_30_0 = CallHistoryListview:GetGenerator()
   if l_30_0 ~= nil then
      local l_30_1 = CallLog:GetCount() - 1     
      local l_30_2 = nil
      local l_30_3 = nil      
      trace("++++++++++++++++++++++ logCount = " .. tostring(l_30_1))
      for i = 0, l_30_1 do
         l_30_2 = l_30_0:GetItem(i)
         if l_30_2 ~= nil then
            local item = CallLog:GetItem(i)
            local pid = PIDatabase:GetCallLogInfoInstance(item)
            local gss = pid:GetStartTime():ToLocal()
            local time = l_30_2.Namespace:FindName("Time")            
            if gss:IsToday() then
               time.String = GetFormatTime(gss)
            else
               time.String = GetFormatDate(gss)
            end
         end
      end
   end
   if CallHistoryFilter ~= 0 then
      CreateListView()
   end
   trace("[PeopleCallHistoryGlobal] ResetCallHistoryDateTimeFormat END")
end

GetFormatDate = function(l_31_0)
   local l_31_1 = ""
   l_31_1 = l_31_0:GetDateString(DateFormatOptions_Default)
   return l_31_1
end

GetFormatTime = function(l_32_0)
   local l_32_1 = ""
   if machineStatus.CurrentTime.Value.IsTwentyFourHour then
      l_32_1 = l_32_0:GetTimeString(TimeFormatOptions_Default)
   else
      l_32_1 = l_32_0:GetTimeString(TimeFormatOptions_ExcludeTimeMarker) .. l_32_0:GetTimeString("tt")
   end
   return l_32_1
end

MyFavesUtilityObj = MyFavesUtility()
if MyFavesUtilityObj:IsMyFavesTurnOn() then
   trace("MyFaves on")
   MyFavesUtilityObj:DismissAllMy5MissedCall()
end
CreatePeopleInfo()
PicLoader = PicLoader_CreateInstance()
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), DoLSK))
_application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), DoRSK))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?