⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 allmessages.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
字号:
-- Decompiled using luadec 1.0 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l2 ;20,24,26;8,14-77,28-77,36-77,41-77,46-77,51-77,56-77,59-77,81,90,104,153,157,163-176,180-188,192,195-212,220,226;;;;;;;7,9,17,52;;; 126e900b_manila.luac 

require("common")
require("messaging_svc")
require("scrollphysics")
require("transitions")
require("machine_status_svc")
require("contacts_database_svc")
ListViewHit = function(l_1_0)
   trace("ListViewHit index = " .. l_1_0)
   if l_1_0 == 0 then
      if _config_os == "windowsmobile" then
       Shell_NavigateTo(ShellLocation_MessagingComposeSMS)
      end
    else
      if l_1_0 > 0 then
         local l_12_0 = MessagingListGenerator:GetItem(l_1_0)
         local l_12_1 = l_12_0.Namespace:FindName("msg_sender")
         local l_12_2 = l_12_0.Tag.Data
         MessageUtils_LaunchPeopleByPhoneNumber(tostring(MailMessage_GetRawAddress(l_12_2:GetSenderAddress())))
         l_12_0:Focus()
      end
   end
end

HandleItemCreated = function(l_2_0, l_2_1)
   l_2_1.Tag = {}
   l_2_1.Tag.Data = l_2_0
   local l_12_0 = ContactsSet[l_2_0:GetSender()]
   if l_12_0 == nil then
      local l_12_1 = l_2_1.Namespace:FindName("msg_pic")
      l_12_1:SetTextureRef("new_message")
      l_12_1.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
      local l_12_2 = l_2_1.Namespace:FindName("msg_sender_bold")
      l_12_2._visible = true
      l_12_2.Position.y = -15
      l_12_2.String = "New message"
      local l_12_3 = l_2_1.Namespace:FindName("msg_time")
      l_12_3._visible = false
      local l_12_4 = l_2_1.Namespace:FindName("msg_subject")
      l_12_4._visible = false
      local l_12_5 = l_2_1.Namespace:FindName("UnreadButtonImage")
      l_12_5._visible = false
      local l_12_6 = l_2_1.Namespace:FindName("msg_unread")
      l_12_6._visible = false
      local l_12_7 = l_2_1.Namespace:FindName("msg_seperator")
      if l_12_7 then
         local l_12_8 = nil
         if _application.Orientation == ScreenOrientation_Portrait then
            l_12_8 = 480
         else
            l_12_8 = 800
         end
         l_12_7.Size.width = l_12_8
         l_12_7.TextureCoords:set(0, 0, l_12_8 / 2, 1)
      end
      return 
   end
   local l_12_9 = l_2_1.Namespace:FindName("msg_subject")
   l_12_9.String = tostring(l_2_0:GetSubject())
   local l_12_10 = l_2_1.Namespace:FindName("msg_time")
   if _application.Orientation == ScreenOrientation_Portrait then
      l_12_10.Position.x = 315
   else
      l_12_10.Position.x = 635
   end
   local l_12_11 = l_2_0:GetTimeReceived():ToLocal()
   if l_12_11:IsToday() then
      l_12_10.String = Locale:GetString("IDS_TODAY") .. " " .. l_12_11:GetTimeString(TimeFormatOptions_Default)
   else
      if l_12_11:IsYesterday() then
         l_12_10.String = Locale:GetString("IDS_YESTERDAY") .. " " .. l_12_11:GetTimeString(TimeFormatOptions_Default)
      else
         l_12_11:GetDateString(DateFormatOptions_UseShortDate)
         l_12_11:GetTimeString(TimeFormatOptions_Default)
         l_12_10.String = l_12_11:GetDateString(DateFormatOptions_UseShortDate) .. " " .. l_12_11:GetTimeString(TimeFormatOptions_Default)
      end
   end
   local l_12_12 = l_2_1.Namespace:FindName("msg_unread")
   local l_12_13 = l_2_1.Namespace:FindName("UnreadButtonImage")
   if l_12_0 > 0 then
      local l_12_14 = l_2_1.Namespace:FindName("msg_sender_bold")
      l_12_14._visible = true
      l_12_14.String = tostring(l_2_0:GetSender())
      l_12_12._visible = true
      l_12_13._visible = true
      l_12_12.String = tostring(l_12_0)
   else
      local l_12_15 = l_2_1.Namespace:FindName("msg_sender")
      l_12_15._visible = true
      l_12_15.String = tostring(l_2_0:GetSender())
      l_12_12._visible = false
      l_12_13._visible = false
   end
   local l_12_16 = l_2_1.Namespace:FindName("msg_seperator")
   if l_12_16 then
      local l_12_17 = nil
      if _application.Orientation == ScreenOrientation_Portrait then
         l_12_17 = 480
      else
         l_12_17 = 800
      end
      l_12_16.Size.width = l_12_17
      l_12_16.TextureCoords:set(0, 0, l_12_17 / 2, 1)
   end
   local l_12_18 = MessageUtils_GetPeoplePicture(tostring(MailMessage_GetRawAddress(l_2_0:GetSenderAddress())))
   if l_12_18 ~= nil then
      local l_12_19 = l_2_1.Namespace:FindName("msg_pic")
      if not l_12_18:HasValue() then
         l_12_19:SetTextureRef("PeoplePlaceholder")
         l_12_19.TextureCoords:set(0, 0, 0.92578125, 0.92578125)
      else
         l_12_19:SetTexture(l_12_18:GetValue().Texture)
         l_12_19.TextureCoords.value = l_12_18:GetValue().UV
      end
   end
   l_2_1.Focusable = true
end

HandleItemDestroyed = function(l_3_0, l_3_1)
end

OnNavigateOut = function(l_4_0)
   MessagingListGenerator.ItemCreated:disconnect(HandleItemCreated)
   MessagingListGenerator.ItemDestroyed:disconnect(HandleItemDestroyed)
   MyNewLibPhysics:DisconnectMouseEvents()
   _request.NavigateOutTo:disconnect(OnNavigateOut)
   MachineStatus().SMSUnread.OnValueChanged:disconnect(machineStatus_OnSMSMMSUnreadChange)
   MachineStatus().MMSUnread.OnValueChanged:disconnect(machineStatus_OnSMSMMSUnreadChange)
   Transition(l_4_0, "Out")
end

OnNavigateIn = function(l_5_0)
   _request.NavigateInFrom:disconnect(OnNavigateIn)
   Transition(l_5_0, "In")
end

AllMessagesMenuExitCallback = function(l_6_0)
   l_6_0.OnExit:disconnect(AllMessagesMenuExitCallback)
   if l_6_0.Result.ExitType ~= DialogExitType_Cancel then
      if l_6_0.Result.UserValue == "New" then
         trace("New")
         if _config_os == "windowsmobile" then
            Shell_NavigateTo(ShellLocation_MessagingComposeSMS)
         end
      elseif l_6_0.Result.UserValue == "Delete" then
         trace("Delete")
         if _config_os == "windowsmobile" then
            _application.Navigation:Navigate(URL("Manila://DeleteMessage/DeleteMessage.page"), true)
         end
      elseif l_6_0.Result.UserValue == "Inbox" then
         trace("inbox")
         if _config_os == "windowsmobile" then
            trace("inbox 2")
            trace(tostring(MessageUtils_GotoSMSBox(0)))
         end
      elseif l_6_0.Result.UserValue == "Outbox" then
         if _config_os == "windowsmobile" then
             MessageUtils_GotoSMSBox(1)
         end
      elseif l_6_0.Result.UserValue == "Drafts" then
        if _config_os == "windowsmobile" then
             MessageUtils_GotoSMSBox(2)
        end
      elseif l_6_0.Result.UserValue == "SentItems" then
        if _config_os == "windowsmobile" then
           MessageUtils_GotoSMSBox(3)
        end
      elseif l_6_0.Result.UserValue == "DeletedItems" then
        if _config_os == "windowsmobile" then
           MessageUtils_GotoSMSBox(4)
         end
      elseif l_6_0.Result.UserValue == "MessageOptions" then
           trace("MessageOptions")
           if _config_os == "windowsmobile" then
              _application.Navigation:Navigate(URL("Manila://MessageOption/MessageOption.page"), true)
           end
       end
   end
end

OnBack = function()
   trace("OnBack")
   _application.Navigation:NavigateBack()
end

OnPopupMenu = function()
   trace("OnPopupMenu")
   if _config_os == "windowsmobile" then
      AllMessagesMenu = _application.DialogManager:GetDialog(URL("Manila://AllMessagesMenu.dialog"))
      AllMessagesMenu.OnExit:connect(AllMessagesMenuExitCallback)
      AllMessagesMenu:Show()
   end
end

SetupListView = function()
   local l_12_0 = MailDatabase("SMS", _application:GetScopedLog("Messaging"))
   local l_12_1 = MailSortBy()
   l_12_1:SORTBY("DeliveryTime", SortDirection_Descending)
   local l_12_2 = (l_12_0:Select(nil, l_12_1))
   MessagesSimpleCollection = nil
   ListLayout = nil
   ContactsSet = nil
   ContactsSet = {}
   if MessagingListGenerator ~= nil then
      MessagingListGenerator.ItemCreated:disconnect(HandleItemCreated)
      MessagingListGenerator.ItemDestroyed:disconnect(HandleItemDestroyed)
      MessagingListGenerator = nil
   end
   MessagesSimpleCollection = MailMessageSimpleQueryResult()
   newMessageItem = MailMessage()
   MessagesSimpleCollection:AddItem(newMessageItem)
   local l_12_3 = l_12_2:GetCount()
   for i = 0, l_12_3 - 1 do
      MailMessageObj = l_12_2:GetItem(i)
      local gs = tostring(MailMessageObj:GetSender())
      if ContactsSet[gs] == nil then
         ContactsSet[gs] = 0
         MessagesSimpleCollection:AddItem(MailMessageObj)
      end
      if MailMessageObj:GetUnread() then
         ContactsSet[gs] = ContactsSet[gs] + 1
      end
   end
   trace("Messages count = " .. tostring(l_12_2:GetCount()))
   ListLayout = TileLayout()
   ListLayout:SetItemSize(480, 80, 0)
   MessagingList:SetLayout(ListLayout)
   MessagingListGenerator = LibraryGeneratorMailMessage(MessagesSimpleCollection, MessagingList:GetMovie(), MessagingList.ComponentLibraryName, MessagingList.ComponentLibraryID)
   MessagingListGenerator.RecycleItems = true
   MessagingListGenerator.ItemCreated:connect(HandleItemCreated)
   MessagingListGenerator.ItemDestroyed:connect(HandleItemDestroyed)
   MessagingList:SetGenerator(MessagingListGenerator)
   MessagingList:Focus()
end

machineStatus_OnSMSMMSUnreadChange = function()
   SetupListView()
end

Main = function()
   if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
      trace("[AllMessages] : EnableLandscape")
      require("AllMessages_Landscape")
      gbRequireLandscape = true
      _AllMessages_ScreenRotation = AllMessages_ScreenRotation(MessagingList, Camera2D, nil, msg_Mask)
   end
   objs3D = {}
   objs3D[1] = Camera2D
   setOffScreen()
   _request.NavigateOutTo:connect(OnNavigateOut)
   _request.NavigateInFrom:connect(OnNavigateIn)
   SetupListView()
   MyNewLibPhysics = ScrollPhysics(MessagingList, MessagingList, ListViewHit)
   MyNewLibPhysics:ConnectMouseEvents()
   if _config_os == "windowsmobile" then
      _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), OnBack))
      _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), OnPopupMenu))
   end
   MachineStatus().SMSUnread.OnValueChanged:connect(machineStatus_OnSMSMMSUnreadChange)
   MachineStatus().MMSUnread.OnValueChanged:connect(machineStatus_OnSMSMMSUnreadChange)
   if _AllMessages_ScreenRotation then
      _AllMessages_ScreenRotation:OnScreenRotation()
   end
end

Main()

⌨️ 快捷键说明

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