peopleupdateviewpage.luac.lua

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

LUA
458
字号
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;0,2,4,13;;;;;;;1,1,1,1,1,1;;;;;0,16,22,48,50;;0,0,0,5;;0,0,0,4,8;;0,12,60;0,13;;;;;;;; 04bff7fb_manila.luac 

require("scrollphysics")
require("transitions")
require("facebook_svc")
require("contacts_database_svc")
require("people\\peopleprofilemessage")
require("people\\PeopleGreetings")
PeopeViewForm = class()
PeopeViewForm.__init = function(l_1_0)
   l_1_0._request = _request
   l_1_0._request.NavigateInFrom:connect(l_1_0.OnNavigateIn, l_1_0)
   l_1_0._request.PageInit:connect(l_1_0.OnPageInit, l_1_0)
   l_1_0._request.NavigateOutTo:connect(l_1_0.OnNavigateOut, l_1_0)
   l_1_0._application = _application
   l_1_0._application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), OnLeftSoftKeyPress))
   l_1_0._application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), OnRightSoftKeyPress))
end

PeopeViewForm.ResetContactPic = function(l_2_0)
   local l_2_1 = PeopleEngine_Instance()
   local l_2_2 = PersonInfo()
   l_2_1:GetPersonInfo(l_2_2)
   PeopleViewName.String = l_2_2:GetName()
   local l_2_3 = l_2_2:GetPersonPicture()
   if l_2_3 ~= nil and l_2_3:HasValue() then
      PeopleViewPic:SetTexture(l_2_3:GetValue().Texture)
      PeopleViewPic.TextureCoords.value = l_2_3:GetValue().UV
   else
      PeopleViewPic:SetTexture("\\Windows\\HTC\\Assets\\Images\\People\\VGA\\PeoplePlaceholder.qtc")
      PeopleViewPic.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
   end
end

PeopeViewForm.OnNavigateIn = function(l_3_0, l_3_1)
   objs3D = {}
   objs3D[1] = Camera2D
   setOffScreen()
   l_3_0:ResetContactPic()
   FBmgr = FacebookManager_Instance()
   FBmgr:CreateConnection()
   _Oid = FBmgr:GetOidFromStore()
   if not FBmgr:IsLinked(_Oid) then
      l_3_0._application:SetRightSoftkey(Softkey("", nil))
   end
   _PeopleViewList = PeopleViewList(_PeopeViewForm:GetCollection())
   FBmgr.OnContactChanged:connect(l_3_0.OnContactModified, l_3_0)
   FBmgr.OnContactDeleted:connect(l_3_0.OnContactRemoved, l_3_0)
   Transition(l_3_1, "In")
end

PeopeViewForm.OnPageInit = function(l_4_0, l_4_1)
   if FBmgr:IsUpdating() then
      EventHeaderElement._visible = true
      UpdateHeaderElement._visible = true
      FBmgr.OnUpdateComplete:connect(l_4_0.onUpdateComplete, l_4_0)
   end
   Transition(l_4_1, "In")
end

PeopeViewForm.OnNavigateOut = function(l_5_0, l_5_1)
   _PeopleViewList:Finalize()
   FBmgr.OnContactChanged:disconnect(l_5_0.OnContactModified, l_5_0)
   FBmgr.OnContactDeleted:disconnect(l_5_0.OnContactRemoved, l_5_0)
   if EventHeaderElement._visible then
      FBmgr.OnUpdateComplete:disconnect(l_5_0.onUpdateComplete, l_5_0)
   end
   l_5_0._request.NavigateInFrom:disconnect(l_5_0.OnNavigateIn, l_5_0)
   l_5_0._request.PageInit:disconnect(l_5_0.OnPageInit, l_5_0)
   l_5_0._request.NavigateOutTo:disconnect(l_5_0.OnNavigateOut, l_5_0)
   Transition(l_5_1, "Out")
end

PeopeViewForm.OnContactModified = function(l_6_0)
   trace("12345")
   _PeopleViewList:Reset(_PeopeViewForm:GetCollection())
   _PeopeViewForm:ResetContactPic()
end

PeopeViewForm.OnContactRemoved = function(l_7_0)
end

OnLeftSoftKeyPress = function()
   _application.Navigation:NavigateBack()
end

OnRightSoftKeyPress = function()
   local l_9_0 = nil
   if FBmgr:IsLogin() then
      l_9_0 = _application.DialogManager:GetDialog(URL("Manila://people-view-menu.dialog"))
   else
      l_9_0 = _application.DialogManager:GetDialog(URL("Manila://people-view-nologin-menu.dialog"))
   end
   l_9_0.OnExit:connect(MenuExitCallback)
   l_9_0:Show()
end

MenuExitCallback = function(l_10_0)
   l_10_0.OnExit:disconnect(MenuExitCallback)
   if l_10_0.Result.ExitType ~= DialogExitType_Cancel then
     if l_10_0.Result.UserValue == "Updates Now" then
       if not FBmgr:IsUpdating() then
        FBmgr:Update(_Oid)
        FBmgr.OnUpdateComplete:connect(_PeopeViewForm.onUpdateComplete, self)
        if EventHeaderElement ~= nil then
           EventHeaderElement._visible = true
        end
        if UpdateHeaderElement ~= nil then
           UpdateHeaderElement._visible = true
        end
      end
    elseif l_10_0.Result.UserValue == "Data Connection Setting" then
       _application.Navigation:Navigate(URL("Manila://people/facebooklogin/connectsetting.page"), true)
    elseif l_10_0.Result.UserValue == "Update Profile Photo" then
       _UpdateProfileMessage = UpdateProfileMessage()
    elseif l_10_0.Result.UserValue == "Remove Link" then
       FBmgr:SetLink(_Oid, "")
       _application:SetRightSoftkey(Softkey("", nil))
       _PeopleViewList:Reset(_PeopeViewForm:GetCollection())
     end
  end
end

PeopeViewForm.GetCollection = function(l_11_0)
   UpdateViewCollection = FBmgr:GetUpdateViewList(_Oid)
   EventViewCollection = FBmgr:GetEventViewList(_Oid)
   UpdatesCount = UpdateViewCollection:GetCount()
   EventsCount = EventViewCollection:GetCount()
   local vni = VectorNotifyint()
   if not FBmgr:IsLinked(_Oid) then
      trace("Is not linked")
      TotalUpdatesCount = 1      
      vni:push_back(-3)
   elseif UpdatesCount == 0 then
      TotalUpdatesCount = 1
      vni:push_back(-1)
   else
      TotalUpdatesCount = UpdatesCount
      for i = 0, UpdatesCount - 1 do
         vni:push_back(i)
      end
   end
   if EventsCount == 0 then
      EventsCount = 1
      vni:push_back(-2)
   else
      for i = UpdatesCount, UpdatesCount + EventsCount - 1 do
         vni:push_back(i)
      end
   end
   return vni
end

PeopeViewForm.onUpdateComplete = function(l_12_0, l_12_1)
   trace("[Facebook]Update complete")
   if l_12_1 then
      trace("[Facebook]Update is Success")
      _PeopleViewList:Reset(_PeopeViewForm:GetCollection())
   else
      trace("[Facebook]Update is failed")
   end
   FBmgr.OnUpdateComplete:disconnect(_PeopeViewForm.onUpdateComplete, l_12_0)
   if EventHeaderElement ~= nil then
      EventHeaderElement._visible = false
   end
   if UpdateHeaderElement ~= nil then
      UpdateHeaderElement._visible = false
   end
end

PeopleViewList = class()
PeopleViewList.__init = function(l_13_0, l_13_1)
   l_13_0._request = _request
   l_13_0.Layout = SequentialLayout()
   l_13_0.Layout:SetItemSize(480, 80, 0)
   l_13_0.Layout:SetHeaderSize(480, 40, 0)
   l_13_0.Layout.DisableVirtualization = true
   l_13_0.ListView = peopleViewListView
   l_13_0.ListView:SetLayout(l_13_0.Layout)
   l_13_0.Collection = l_13_1
   l_13_0.Generator = SequentialLibraryGeneratorint(l_13_0.Collection, l_13_0.ListView:GetMovie(), l_13_0.ListView.ComponentLibraryName, l_13_0.ListView.ComponentLibraryID)
   l_13_0.Generator:SetHeaderComponent(l_13_0.ListView:GetMovie(), l_13_0.ListView.ComponentLibraryName, "PViewHeader")
   l_13_0.Generator.HeaderCreated:connect(l_13_0.OnHeaderCreated, l_13_0)
   l_13_0.Generator.ItemCreated:connect(l_13_0.OnItemCreated, l_13_0)
   l_13_0.Generator.ItemDestroyed:connect(l_13_0.OnItemDestroyed, l_13_0)
   l_13_0.Generator.GroupFunction:connect(l_13_0.OnHeaderGroup, l_13_0)
   l_13_0.ListView:SetGenerator(l_13_0.Generator)
   l_13_0.ListPhysics = ScrollPhysics(l_13_0.ListView, l_13_0.ListView, HandleSelection)
   l_13_0.ListPhysics:ConnectMouseEvents()
   UpdateHeaderElement = nil
   EventHeaderElement = nil
end

PeopleViewList.Finalize = function(l_14_0)
   if nil ~= l_14_0.ListPhysics then
      l_14_0.ListPhysics:DisconnectMouseEvents()
      l_14_0.ListPhysics:CancelBehaviorCallback()
   end
   if nil == l_14_0.ListView then
      return 
   end
   local l_14_1 = l_14_0.ListView:GetLayout()
   if nil == l_14_1 then
      return 
   end
   local l_14_2 = l_14_0.ListView:GetGenerator()
   if nil == l_14_2 then
      return 
   end
   l_14_2.GroupFunction:disconnect(l_14_0.OnHeaderGroup, l_14_0)
   l_14_2.HeaderCreated:disconnect(l_14_0.OnHeaderCreated, l_14_0)
   l_14_0.Generator.ItemDestroyed:disconnect(l_14_0.OnItemDestroyed, l_14_0)
   l_14_2.ItemCreated:disconnect(l_14_0.OnItemCreated, l_14_0)
   local l_14_3 = l_14_1:GetVisibleHeadIndex()
   local l_14_4 = l_14_1:GetVisibleCount()
   local l_14_5 = l_14_3 + l_14_4 - 1
   l_14_0.ListView = nil
end

PeopleViewList.Reset = function(l_15_0, l_15_1)
   l_15_0:Finalize()
   l_15_0.Collection = l_15_1
   l_15_0.Layout = SequentialLayout()
   l_15_0.Layout.DisableVirtualization = true
   l_15_0.Layout:SetItemSize(480, 80, 0)
   l_15_0.Layout:SetHeaderSize(480, 40, 0)
   l_15_0.ListView = peopleViewListView
   l_15_0.ListView:SetLayout(l_15_0.Layout)

⌨️ 快捷键说明

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