contactobject.luac.lua

来自「htc manila 2 sourcecode」· LUA 代码 · 共 321 行

LUA
321
字号
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;0,11,12;;;;;;0,5,24;0,10,35,36;0,12;0,5;;;;;;;;;0,0,9;;;;;;;;; 798ecade_manila.luac 

trace("Load ContactObject ......")
require("contacts_database_svc")
require("ScrollPhysics")
require("ActiveSyncDetect")
ContactControl = class()
ContactControl.__init = function(l_1_0, l_1_1, l_1_2, l_1_3, l_1_4, l_1_5)
   trace("init contact object")
   l_1_0.widthPeopleItem = 480
   l_1_0.heightPeopleItem = 80
   l_1_0.ListViewHighPosY = 288
   l_1_0.ListViewLowPosY = 228
   l_1_0.bUpdatedContactList = false
   l_1_0.strSearchContact = ""
   l_1_0.strRegBrowserSource = "PeopleBrowserSource"
   l_1_0.strRegCategorySource = "PeopleCategorySource"
   l_1_0.Favorite = false
   l_1_0.offset = 0
   l_1_0.Savedoffset = l_1_0.offset
   l_1_0.CreateFunction = l_1_2
   l_1_0.DestroyFunction = l_1_3
   l_1_0.SelectionFunction = l_1_4
   l_1_0.PeopleEngine = PeopleEngine_Instance()
   l_1_0.ContactList = PeopleList()
   l_1_0.TitleString = TitleString
   if l_1_5 ~= nil then
      l_1_0.IsFavoriteCandidates = l_1_5
   else
      l_1_0.IsFavoriteCandidates = false
   end
   if l_1_0.IsFavoriteCandidates then
      trace("~~~~~~~~FavoriteCandidates")
      l_1_0.ContactList.OnContactChanged:connect(l_1_0.HandleFavoriteCandidatesChanged, l_1_0)
      l_1_0.ContactList.OnContactCreated:connect(l_1_0.HandleFavoriteCandidatesChanged, l_1_0)
      l_1_0.ContactList.OnContactDeleted:connect(l_1_0.HandleFavoriteCandidatesChanged, l_1_0)
   else
      trace("~~~~~~~~not FavoriteCandidates")
      l_1_0.ContactList.OnContactChanged:connect(l_1_0.HandleContactChanged, l_1_0)
      l_1_0.ContactList.OnContactCreated:connect(l_1_0.HandleContactChanged, l_1_0)
      l_1_0.ContactList.OnContactDeleted:connect(l_1_0.HandleContactChanged, l_1_0)
   end
   l_1_0.listview = l_1_1
   l_1_0.Collection = VectorNotifyint()
   l_1_0.ContactData = nil
   l_1_0.ListPhysics = nil
   l_1_0:InitListView()
   l_1_0.SelectedIndex = 0
   l_1_0.IsShowHeadItem = true
   l_1_0.FavoriteCount = 0
   l_1_0.ActiveSyncDetect = nil
   l_1_0.ActiveSyncDetect_Candidate = nil
   l_1_0.nFirstRoundInsertCount = 16
   l_1_0.nBatchIndex = -1
   l_1_0.nBatchIndexLast = -1
   l_1_0.objBatchInsertTimer = timer(0.099990844726563)
   l_1_0.objBatchInsertTimer:Stop()
   l_1_0.objBatchInsertTimer.OnElapsed:connect(ContactControl.BatchInsertTimerElapsed, l_1_0)
   trace("init contact object end")
end

ContactControl.BatchInsertTimerElapsed = function(l_2_0)
   if l_2_0.objBatchInsertTimer == nil then
      trace("objBatchInsertTimer is nil")
      return 
   end
   l_2_0.objBatchInsertTimer:Stop()
   local l_2_1 = l_2_0.nBatchIndex
   local l_2_2 = l_2_0.nBatchIndexLast
   if l_2_1 < 0 or l_2_2 < 0 then
      return 
   end
   for i = l_2_1, l_2_2 do
      l_2_0.Collection:push_back(i)
   end
   l_2_0.listview:GetMovieClip():RequestUpdate()
end

ContactControl.DisconnectEvents = function(l_3_0)
   if l_3_0.objBatchInsertTimer ~= nil then
      l_3_0.objBatchInsertTimer:Stop()
   end
   l_3_0.ListPhysics:DisconnectMouseEvents()
   if l_3_0.CreateFunction ~= nil then
      l_3_0.listview:GetGenerator().ItemCreated:disconnect(l_3_0.CreateFunction)
   end
   if l_3_0.DestroyFunction ~= nil then
      l_3_0.listview:GetGenerator().ItemDestroyed:disconnect(l_3_0.DestroyFunction)
   end
   if l_3_0.IsFavoriteCandidates then
      l_3_0.ContactList.OnContactChanged:disconnect(l_3_0.HandleFavoriteCandidatesChanged, l_3_0)
      l_3_0.ContactList.OnContactCreated:disconnect(l_3_0.HandleFavoriteCandidatesChanged, l_3_0)
      l_3_0.ContactList.OnContactDeleted:disconnect(l_3_0.HandleFavoriteCandidatesChanged, l_3_0)
   else
      l_3_0.ContactList.OnContactChanged:disconnect(l_3_0.HandleContactChanged, l_3_0)
      l_3_0.ContactList.OnContactCreated:disconnect(l_3_0.HandleContactChanged, l_3_0)
      l_3_0.ContactList.OnContactDeleted:disconnect(l_3_0.HandleContactChanged, l_3_0)
   end
end

ContactControl.SetOffset = function(l_4_0, l_4_1)
   l_4_0.offset = l_4_1
end

ContactControl.SavedOffset = function(l_5_0, l_5_1)
   l_5_0.Savedoffset = l_5_1
end

ContactControl.GetCount = function(l_6_0, l_6_1, l_6_2, l_6_3)
   local r4 = l_6_0.ContactList:Get(l_6_1, l_6_2, l_6_3):GetCount()
   return r4
end

ContactControl.SetViewPort = function(l_7_0, l_7_1, l_7_2, l_7_3)
   l_7_0.listview.Viewport.x = l_7_1
   l_7_0.listview.Viewport.y = l_7_2
   l_7_0.listview.Viewport.z = l_7_3
end

ContactControl.InitListView = function(l_8_0)
   trace("InitListView")
   local l_8_1 = TileLayout()
   l_8_1:SetItemSize(l_8_0.widthPeopleItem, l_8_0.heightPeopleItem, 0)
   l_8_0.listview:SetLayout(l_8_1)
   local l_8_2 = LibraryGeneratorint(l_8_0.Collection, l_8_0.listview:GetMovie(), l_8_0.listview.ComponentLibraryName, l_8_0.listview.ComponentLibraryID)
   l_8_2.ItemCreated:connect(l_8_0.CreateFunction)
   l_8_2.ItemDestroyed:connect(l_8_0.DestroyFunction)
   l_8_2.RecycleItems = true
   l_8_0.listview:SetGenerator(l_8_2)
   l_8_0.ListPhysics = ScrollPhysics(l_8_0.listview, l_8_0.listview, l_8_0.SelectionFunction, true)
   trace("InitListView end")
end

ContactControl.RefreshListView = function(l_9_0)
   trace("RefreshListView")
   if l_9_0.objBatchInsertTimer ~= nil then
      l_9_0.objBatchInsertTimer:Stop()
   end
   local l_9_1 = 0
   l_9_1 = l_9_0.Collection:GetCount()
   while l_9_1 > 0 do
     l_9_0.Collection:pop_back()
     l_9_1 = l_9_1 - 1
   end
   l_9_1 = 0 - l_9_0.offset
   while l_9_1 < 0 do
     l_9_0.Collection:push_back(l_9_1)
     l_9_1 = l_9_1 + 1
   end
   do
     local l_9_2 = l_9_0.ContactData:GetCount() - 1
     local l_9_3 = l_9_0.nFirstRoundInsertCount
     if l_9_2 < l_9_3 then
        for i = 0, l_9_2 do
           l_9_0.Collection:push_back(i)
        end
     else
        for i = 0, l_9_3 - 1 do
           l_9_0.Collection:push_back(i)
        end
        l_9_0.nBatchIndex = l_9_3
        l_9_0.nBatchIndexLast = l_9_2
        l_9_0.objBatchInsertTimer:Start()
     end
   end
   l_9_0.ListPhysics:DisconnectMouseEvents()
   l_9_0.ListPhysics:ConnectMouseEvents()
   l_9_0.listview:Focus()
   trace("RefreshListView end")
end

ContactControl.ShowHeadItem = function(l_10_0)
   if not l_10_0.IsShowHeadItem then
      if l_10_0.Favorite == true and l_10_0.FavoriteCount >= 15 then
         return 
      end
      l_10_0.IsShowHeadItem = true
      local l_10_1 = l_10_0.offset
      for i = 1, l_10_1 do
         l_10_0.Collection:insert(0, -i)
      end
   end
end

ContactControl.HideHeadItem = function(l_11_0)
   if l_11_0.IsShowHeadItem then
      l_11_0.IsShowHeadItem = false
      local l_11_1 = l_11_0.offset
      for i = 1, l_11_1 do
         l_11_0.Collection:remove(0)
      end
   end
end

ContactControl.SetFavorite = function(l_12_0, l_12_1)
   l_12_0.Favorite = l_12_1
end

ContactControl.SetSelectorNode = function(l_13_0, l_13_1)
   l_13_0.listview:GetLayout().SelectionNode = l_13_1
end

ContactControl.SetContactPicture = function(l_14_0, l_14_1, l_14_2)
   trace("SetContactPicture")
   if l_14_1:GetValue():IsEmpty() then
      l_14_2:SetTextureRef("PeoplePlaceholderSmall")
      l_14_2.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
   else
      l_14_2:SetTexture(l_14_1:GetValue().Texture)
      l_14_2.TextureCoords.value = l_14_1:GetValue().UV
   end
   trace("SetContactPicture end")
end

ContactControl.ViewAll = function(l_15_0, l_15_1)
   l_15_0:SetViewSource(TFrom_All)
   l_15_0:FilterContactsFormSource(l_15_1)
end

ContactControl.ViewContacts = function(l_16_0, l_16_1)
   l_16_0:SetViewSource(TFrom_Device)
   l_16_0:FilterContactsFormSource(l_16_1)
end

ContactControl.ViewSim = function(l_17_0, l_17_1)
   l_17_0:SetViewSource(TFrom_SIM)
   l_17_0:FilterContactsFormSource(l_17_1)
end

ContactControl.ViewNewUpdated = function(l_18_0, l_18_1)
   l_18_0:SetViewSource(TFrom_Updated)
   l_18_0:FilterContactsFormSource(l_18_1)
end

ContactControl.ViewFavoriteCandidates = function(l_19_0)
   trace("ViewFavoriteCandidates")
   l_19_0:SetViewSource(TFrom_Device)
   l_19_0.ContactData = l_19_0.ContactList:GetFavoriteCandidates()
   l_19_0:RefreshListView()
end

ContactControl.FilterContactsFormSource = function(l_20_0, l_20_1)
   trace("FilterContactsFormSource")
   local l_20_2 = _application.Store:GetIntValue(Lifetime_Permanent, l_20_0.strRegBrowserSource)
   l_20_0.bUpdatedContactList = false
   if l_20_1 == nil then
     l_20_1 = false
   end
   l_20_0.ContactData = l_20_0.ContactList:Get(l_20_2, l_20_1, l_20_0.Favorite)
   l_20_0.ContactData = l_20_0.ContactList:Filter(l_20_0.strSearchContact)
   if l_20_0.Favorite == true then
      l_20_0.FavoriteCount = l_20_0.ContactData:GetCount()
   end
   l_20_0:RefreshListView()
end

ContactControl.SetViewSource = function(l_21_0, l_21_1)
   _application.Store:SetIntValue(Lifetime_Permanent, l_21_0.strRegBrowserSource, l_21_1)
end

ContactControl.GetViewSource = function(l_22_0)
   local l4 = _application.Store:GetIntValue(Lifetime_Permanent, l_22_0.strRegBrowserSource)
   return l4
end

ContactControl.HandleContactChanged = function(l_23_0)
   trace("HandleContactChanged")
   if l_23_0.ActiveSyncDetect == nil then
      l_23_0.ActiveSyncDetect = ActiveSyncDetect(nil, l_23_0.FilterContactsFormSource, l_23_0)
   end
   if l_23_0.ActiveSyncDetect:IsSyncing() then
      l_23_0.ActiveSyncDetect:StartWaiting()
   else
      if _application.Visibility == true and not l_23_0.ActiveSyncDetect:IsSyncing() then
         l_23_0:FilterContactsFormSource()
      else
         l_23_0.bUpdatedContactList = true
      end
   end
end

ContactControl.HandleFavoriteCandidatesChanged = function(l_24_0)
   if l_24_0.ActiveSyncDetect_Candidate == nil then
      l_24_0.ActiveSyncDetect_Candidate = ActiveSyncDetect(nil, l_24_0.ViewFavoriteCandidates, l_24_0)
   end
   if l_24_0.ActiveSyncDetect_Candidate:IsSyncing() then
      l_24_0.ActiveSyncDetect_Candidate:StartWaiting()
   else
      if _application.Visibility == true and not l_24_0.ActiveSyncDetect_Candidate:IsSyncing() then
         l_24_0:ViewFavoriteCandidates()
      else
         l_24_0.bUpdatedContactList = true
      end
   end
end

ContactControl.LaunchNewContact = function(l_25_0)
   trace("LaunchNewContact")
   Shell_ContactEditor("New")
end

ContactControl.LaunchMyCard = function(l_26_0)
   trace("LaunchMyCard")
   Shell_ContactEditor("Me")
end

ContactControl.GetScrollPhysics = function(l_27_0)
   return l_27_0.ListPhysics
end

ContactControl.ListPhysicsIsScrolling = function(l_28_0)
   if l_28_0.ListPhysics == nil then
     return false
   end
   return l_28_0.ListPhysics:IsScrolling()
end

trace("Load ContactObject end")

⌨️ 快捷键说明

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