peopleupdateviewpage.luac.lua

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

LUA
458
字号
   l_15_0.Collection = l_15_1
   l_15_0.Generator = SequentialLibraryGeneratorint(l_15_0.Collection, l_15_0.ListView:GetMovie(), l_15_0.ListView.ComponentLibraryName, l_15_0.ListView.ComponentLibraryID)
   l_15_0.Generator:SetHeaderComponent(l_15_0.ListView:GetMovie(), l_15_0.ListView.ComponentLibraryName, "PViewHeader")
   l_15_0.Generator.HeaderCreated:connect(l_15_0.OnHeaderCreated, l_15_0)
   l_15_0.Generator.ItemCreated:connect(l_15_0.OnItemCreated, l_15_0)
   l_15_0.Generator.ItemDestroyed:connect(l_15_0.OnItemDestroyed, l_15_0)
   l_15_0.Generator.GroupFunction:connect(l_15_0.OnHeaderGroup, l_15_0)
   l_15_0.ListView:SetGenerator(l_15_0.Generator)
   l_15_0.ListPhysics = ScrollPhysics(l_15_0.ListView, l_15_0.ListView, HandleSelection)
   l_15_0.ListPhysics:ConnectMouseEvents()
   UpdateHeaderElement = nil
   EventHeaderElement = nil
end

PeopleViewList.OnItemCreated = function(l_16_0, l_16_1, l_16_2)
   l_16_2.Focusable = true
   local l_16_3 = l_16_2.Namespace:FindName("PViewListHeader")
   local l_16_4 = l_16_2.Namespace:FindName("PViewListDate")
   local l_16_5 = l_16_2.Namespace:FindName("PViewListDes")
   local l_16_6 = l_16_2.Namespace:FindName("EventsIcon")
   if l_16_1 == -1 then
      l_16_3.String = Locale:GetString("IDS_NOUPDATESDATA")
      l_16_4._visible = false
      l_16_5._visible = false
   elseif l_16_1 == -2 then
      l_16_3.String = Locale:GetString("IDS_NOEVENTSDATA")
      l_16_4._visible = false
      l_16_5._visible = false
   elseif l_16_1 == -3 then
      l_16_3.String = Locale:GetString("IDS_LINK")
      l_16_5.String = Locale:GetString("IDS_NOLINK_MESSAGE")
      l_16_4._visible = false
   elseif l_16_1 < UpdatesCount then
      local l_16_7 = UpdateViewCollection:GetItem(l_16_1)
      l_16_3.String = Locale:GetString(l_16_7.Caption)
      if l_16_7.Time:IsToday() then
         l_16_4.String = l_16_7.Time:ToLocal():GetTimeString("HH:mm")
      else
         l_16_4.String = l_16_7.Time:GetDateString("MMM d")
      end
      if l_16_7.PhotoCount > 0 then
         l_16_5.String = l_16_7.PhotoCount .. " " .. Locale:GetString(l_16_7.Status)
      else
         l_16_5.String = Locale:GetString(l_16_7.Status)
      end
   else
      local l_16_7 = EventViewCollection:GetItem(l_16_1 - UpdatesCount)
      l_16_3.String = Locale:GetString(l_16_7.Caption)
      l_16_5.String = Locale:GetString(l_16_7.Status)
      if l_16_7.Type == EventType_Birthday then
         l_16_4.String = l_16_7.Time:GetDateString("MMM d")
         l_16_6._visible = true
         l_16_6:SetTexture("\\Windows\\HTC\\Assets\\Images\\People\\VGA\\Icon_12_aquarius.qtc")
      else
         if l_16_7.Type == EventType_Anniversary then
            l_16_4.String = l_16_7.Time:GetDateString("MMM d")
            l_16_6._visible = true
            l_16_6:SetTexture("\\Windows\\HTC\\Assets\\Images\\People\\VGA\\Icon_Anniversary.qtc")
         else
            if l_16_7.Time:IsToday() then
               l_16_4.String = l_16_7.Time:ToLocal():GetTimeString("HH:mm")
            else
               l_16_4.String = l_16_7.Time:GetDateString("MMM d")
            end
         end
      end
   end
end


PeopleViewList.OnItemDestroyed = function(l_17_0, l_17_1)
   if UpdateHeaderElement == l_17_1 then
      UpdateHeaderElement = nil
   elseif EventHeaderElement == l_17_1 then
      EventHeaderElement = nil
   end
end

PeopleViewList.OnHeaderCreated = function(l_18_0, l_18_1, l_18_2)
   local l_18_3 = l_18_2.Namespace:FindName("PViewHeaderText")
   local l_18_4 = l_18_2.Namespace:FindName("UpdatingText")
   if l_18_1 == UpdatesCount or l_18_1 == -2 then
      l_18_3.String = Locale:GetString("IDS_EVENTS")
      EventHeaderElement = l_18_4
      EventHeaderElement._visible = FBmgr:IsUpdating()
   else
      l_18_3.String = Locale:GetString("IDS_UPDATES")
      UpdateHeaderElement = l_18_4
      UpdateHeaderElement._visible = FBmgr:IsUpdating()
   end
end

PeopleViewList.OnHeaderGroup = function(l_19_0, l_19_1, l_19_2)
   if l_19_2 == UpdatesCount or l_19_2 == -2 then
      return -1
   else
      return 0
   end
end

HandleSelection = function(l_20_0)
   if l_20_0 == 0 or l_20_0 == TotalUpdatesCount + 1 then
      return 
   end
   local l_20_1 = _PeopleViewList.Generator:GetDataByRealizedIndex(l_20_0)
   if l_20_1 == -1 then
   elseif l_20_1 == -2 then
   elseif l_20_1 == -3 then
     if FBmgr:IsLogin() then
       _application.Navigation:Navigate(URL("Manila://people/facebooklogin/selectaccount.page"), true)
     else
       _application.Navigation:Navigate(URL("Manila://people/facebooklogin/facebooklogin.page"), true)
     end
   else
     if l_20_1 < UpdatesCount then
         local item = UpdateViewCollection:GetItem(l_20_1)
         FBmgr:GoToURL(item.URL)
     else
       local l_20_2 = EventViewCollection:GetItem(l_20_1 - UpdatesCount)
       if l_20_2.Type == EventType_Birthday then
          BirthdayItem = BirthdayObj(l_20_2)
       elseif l_20_2.Type == EventType_Anniversary then
          AnniversaryItem = AnniversaryObj(l_20_2)
       else
          FBmgr:GoToURL(l_20_2.URL)
       end
     end
   end
end

UpdateProfileMessage = class(PeopleUpdateProfileMessage)
UpdateProfileMessage.__init = function(l_21_0)
   PeopleUpdateProfileMessage.__init(l_21_0)
   FBmgr.OnUpdateComplete:connect(l_21_0.onUpdateComplete, l_21_0)
   local l_21_1 = FBmgr:GetFriendList()
   l_21_0.FriendItem = l_21_1:FindByOid(_Oid)
   InitializeCheckbox(CheckComponent, l_21_0.FriendItem.AutoUpdate)
   _application:SetLeftSoftkey(Softkey("", nil))
   _application:SetRightSoftkey(Softkey("", nil))
   _PeopleViewList.ListPhysics:DisconnectMouseEvents()
   _application.Navigation.TabVisibility = false
   l_21_0:SetUI(l_21_0.FriendItem.Name, nil, "", true)
   FBmgr:Update(l_21_0.FriendItem.StrOid)
   l_21_0.IsUpdateComplete = false
end

UpdateProfileMessage.onUpdateComplete = function(l_22_0, l_22_1)
   trace("[Facebook]Update complete")
   FBmgr.OnUpdateComplete:disconnect(l_22_0.onUpdateComplete, l_22_0)
   l_22_0.IsUpdateComplete = true
   if l_22_1 then
     l_22_0:SetUI(l_22_0.FriendItem.Name, l_22_0.FriendItem.FBBirthday, l_22_0.FriendItem.PhotoPath, false)
     l_22_0:SetLeftButtonEvent()
   else
     trace("[Facebook]Update is failed")
     l_22_0:SetUI(l_22_0.FriendItem.Name, nil, "", false)
   end
end

UpdateProfileMessage.OnLeftButtonRelease = function(l_23_0)
   PeopleUpdateProfileMessage.OnLeftButtonRelease(l_23_0)
   FBmgr:SetAutoUpdate(_Oid, CheckComponent.Tag.Value)
   FBmgr:SetPic(_Oid, l_23_0.FriendItem.PhotoPath)
   FBmgr:SetBirthday(_Oid, l_23_0.FriendItem.FBBirthday)
   _PeopeViewForm:ResetContactPic()
end

UpdateProfileMessage.Destroy = function(l_24_0)
   PeopleUpdateProfileMessage.Destroy(l_24_0)
   if not l_24_0.IsUpdateComplete then
      FBmgr.OnUpdateComplete:disconnect(l_24_0.onUpdateComplete, l_24_0)
   else
      l_24_0:DisconnectLeftButtonEvent()
   end
   if _PeopleViewList.ListPhysics ~= nil then
      _PeopleViewList.ListPhysics:ConnectMouseEvents()
   end
   _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), OnLeftSoftKeyPress))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), OnRightSoftKeyPress))
   _application.Navigation.TabVisibility = true
end

AnniversaryObj = class(PeopleGreetingComponent)
AnniversaryObj.__init = function(l_25_0, l_25_1)
   PeopleGreetingComponent.__init(l_25_0)
   l_25_0.eventitem = l_25_1
   _PeopleViewList.ListPhysics:DisconnectMouseEvents()
   WindowTitleText.String = Locale:GetString("IDS_ANNIVERSARY_GREETINGS")
   _application:SetLeftSoftkey(Softkey("", nil))
   _application:SetRightSoftkey(Softkey("", nil))
   l_25_0:SetAllElement(l_25_0.eventitem.FileAs .. " " .. Locale:GetString("IDS_FACEBOOK_EVENT_ANNIVERSARY"), l_25_0.eventitem.Time:GetDateString("MMM d"), FBmgr:GetPhoneNumber(l_25_0.eventitem.StrOid), l_25_0.eventitem.StrOid)
   _application.Navigation.TabVisibility = false
end

AnniversaryObj.Destroy = function(l_26_0)
   PeopleGreetingComponent.Destroy(l_26_0)
   if _PeopleViewList.ListPhysics ~= nil then
      _PeopleViewList.ListPhysics:ConnectMouseEvents()
   end
   _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), OnLeftSoftKeyPress))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), OnRightSoftKeyPress))
   _application.Navigation.TabVisibility = true
end

BirthdayObj = class(PeopleGreetingComponent)
BirthdayObj.__init = function(l_27_0, l_27_1)
   PeopleGreetingComponent.__init(l_27_0)
   l_27_0.eventitem = l_27_1
   _PeopleViewList.ListPhysics:DisconnectMouseEvents()
   WindowTitleText.String = Locale:GetString("IDS_BIRTHDAY_GREETINGS")
   _application:SetLeftSoftkey(Softkey("", nil))
   _application:SetRightSoftkey(Softkey("", nil))
   l_27_0:SetAllElement(l_27_0.eventitem.FileAs .. " " .. Locale:GetString("IDS_FACEBOOK_EVENT_BIRTHDAY"), l_27_0.eventitem.Time:GetDateString("MMM d"), FBmgr:GetPhoneNumber(l_27_0.eventitem.StrOid), l_27_0.eventitem.StrOid)
   _application.Navigation.TabVisibility = false
end

BirthdayObj.Destroy = function(l_28_0)
   PeopleGreetingComponent.Destroy(l_28_0)
   if _PeopleViewList.ListPhysics ~= nil then
      _PeopleViewList.ListPhysics:ConnectMouseEvents()
   end
   _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), OnLeftSoftKeyPress))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), OnRightSoftKeyPress))
   _application.Navigation.TabVisibility = true
end

_PeopeViewForm = PeopeViewForm()

⌨️ 快捷键说明

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