messaging.luac.lua
来自「htc manila 2 sourcecode」· LUA 代码 · 共 812 行 · 第 1/3 页
LUA
812 行
if l_29_0 < SelectedMessageIndex and SelectedMessageIndex < l_29_0 + l_29_1 then
SelectIndex(SelectedMessageIndex)
end
end
UpdateDisplay = function()
if Messages:GetCount() > 0 then
local l_30_0 = Messages:GetCount()
if MaxMessageCount < l_30_0 then
l_30_0 = MaxMessageCount
end
MessageNumberText.String = tostring(SelectedMessageIndex + 1) .. " " .. MessageSeparator .. " " .. tostring(l_30_0)
MessageNumberText._visible = true
else
SelectedMessageIndex = -1
if IsAnimatingOut == false then
IsAnimatingOut = true
AnimateCurrentOut(HandleAnimateOutComplete)
end
MessageNumberText._visible = false
end
UpdateArrows()
end
ShowDeleteConfirmDialog = function()
local l_31_0 = URL("Manila://Confirmation.dialog")
l_31_0.Parameters:AddParameter("Title", Locale:GetString("IDS_MESSAGING_CONFIRM_DELETE_TITLE"))
l_31_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_MESSAGING_CONFIRM_DELETE"))
local l_31_1 = _application.DialogManager:GetDialog(l_31_0)
l_31_1.OnExit:connect(OnDeleteDialogExit)
l_31_1:Show()
end
OnDeleteDialogExit = function(l_32_0)
l_32_0.OnExit:disconnect(OnDeleteDialogExit)
trace("Dialog exit! - " .. l_32_0.Result.ExitType)
if l_32_0.Result.ExitType == DialogExitType_OK then
trace("Dialog OK!")
if SelectedMessageIndex >= 0 and SelectedMessageIndex < Messages:GetCount() then
trace("Calling delete!")
local l_32_1 = Messages:GetItem(SelectedMessageIndex)
MessageDatabase:Delete(l_32_1)
end
end
end
MessagingGizmoMenuExitCallback = function(l_33_0)
if l_33_0.Result.ExitType ~= DialogExitType_Cancel then
if l_33_0.Result.UserValue == "New" then
if _config_os == "windowsmobile" then
Shell_NavigateTo(ShellLocation_MessagingComposeSMS)
end
elseif l_33_0.Result.UserValue == "Reply" then
if _config_os == "windowsmobile" then
if SelectedMessageIndex >= 0 and SelectedMessageIndex < Messages:GetCount() then
local sa = Messages:GetItem(SelectedMessageIndex)
local x = MessageDatabase:GetUseSignatureReplyForwardProperty()
if x then
Shell_ComposeMessage("SMS", sa:GetSenderAddress())
else
Shell_ComposeMessage("SMS", sa:GetSenderAddress(), "", "")
end
end
end
elseif l_33_0.Result.UserValue == "Delete" then
if _config_os == "windowsmobile" then
ShowDeleteConfirmDialog()
end
elseif l_33_0.Result.UserValue == "Forward" then
if _config_os == "windowsmobile" and
SelectedMessageIndex >= 0 and SelectedMessageIndex < Messages:GetCount() then
local l_33_1 = Messages:GetItem(SelectedMessageIndex)
l_33_1:Forward()
end
end
end
end
OnMessageTimerElapsed = function(l_34_0)
l_34_0:Stop()
l_34_0.OnElapsed:disconnect(OnMessageTimerElapsed)
if SelectedMessageIndex >= 0 and SelectedMessageIndex < Messages:GetCount() and _config_os == "windowsmobile" then
local l_34_1 = Messages:GetItem(SelectedMessageIndex)
l_34_1.Unread = false
trace("Marked item as read!")
end
end
HandleAnimateInComplete = function()
if _config_os == "windowsmobile" then
MessageTimer = timer(3)
MessageTimer.OnElapsed:connect(OnMessageTimerElapsed)
end
end
HandleAnimateOutComplete = function()
IsAnimatingOut = false
if SelectedMessageIndex >= 0 and SelectedMessageIndex < Messages:GetCount() then
backdrop._visible = true
NoMessages._visible = false
MessageNumberText._visible = true
if _config_os == "windowsmobile" then
local l_36_0 = Messages:GetItem(SelectedMessageIndex)
MessageSenderText.String = l_36_0:GetSender()
local l_36_1 = l_36_0:GetSubject()
if l_36_1 == "" then
l_36_1 = l_36_0:GetBody()
end
if l_36_1 == "" and l_36_0:GetMessageType() == MessageType_MMS then
l_36_1 = Locale:GetString("IDS_VIEWMMS")
end
MessageText.String = l_36_1
local l_36_2 = l_36_0:GetTimeReceived():ToLocal()
local l_36_3 = Time_GetNow()
if l_36_2.IsValid == true then
DateTimeText._visible = true
if l_36_2:IsToday() then
DateTimeText.String = Locale:GetString("IDS_TODAY") .. " " .. l_36_2:GetTimeString(TimeFormatOptions_Default)
else
if l_36_2:IsYesterday() then
DateTimeText.String = Locale:GetString("IDS_YESTERDAY") .. " " .. l_36_2:GetTimeString(TimeFormatOptions_Default)
else
DateTimeText.String = l_36_2:GetDateString(DateFormatOptions_UseShortDate) .. " " .. l_36_2:GetTimeString(TimeFormatOptions_Default)
end
end
else
DateTimeText._visible = false
end
if l_36_0:GetMessageType() == MessageType_SMS then
AnimateTextMessageIn(HandleAnimateInComplete)
else
if l_36_0:GetMessageType() == MessageType_MMS then
AnimateMMSMessageIn(HandleAnimateInComplete)
else
AnimateTextMessageIn(HandleAnimateInComplete)
end
end
else
AnimateTextMessageIn(HandleAnimateInComplete)
end
else
backdrop._visible = false
NoMessages._visible = true
end
UpdateArrows()
end
HandleUpArrowRelease = function(l_37_0)
UpArrow.Opacity:Interpolate(100, 25, 5, 0, Interpolate_EaseOutQuad)
UpArrow.Opacity:Interpolate(25, 100, 5, 5, Interpolate_EaseInQuad)
SetDirectionValues(nil)
SelectIndex(SelectedMessageIndex - 1)
end
HandleDownArrowRelease = function(l_38_0)
DownArrow.Opacity:Interpolate(100, 25, 5, 0, Interpolate_EaseOutQuad)
DownArrow.Opacity:Interpolate(25, 100, 5, 5, Interpolate_EaseInQuad)
SetDirectionValues(1)
SelectIndex(SelectedMessageIndex + 1)
end
HandleNewSMSRelease = function(l_39_0)
if IsPressed == true then
if _config_os == "windowsmobile" then
Shell_NavigateTo(ShellLocation_MessagingComposeSMS)
end
IsPressed = false
l_39_0:SetTextureRef("new_message")
end
end
HandleNewSMSReleaseOutside = function(l_40_0)
IsPressed = false
l_40_0:SetTextureRef("new_message")
end
HandleNewSMSRollOut = function(l_41_0)
l_41_0:SetTextureRef("new_message")
end
HandleNewSMSRollOver = function(l_42_0)
if IsPressed == true then
l_42_0:SetTextureRef("new_message_down")
end
end
HandleNewSMSPress = function(l_43_0)
IsPressed = true
l_43_0:SetTextureRef("new_message_down")
end
SelectIndex = function(l_44_0)
if l_44_0 >= 0 and l_44_0 < Messages:GetCount() and l_44_0 < MaxMessageCount then
if _config_os == "windowsmobile" and MessageTimer ~= nil then
MessageTimer:Stop()
MessageTimer.OnElapsed:disconnect(OnMessageTimerElapsed)
end
SelectedMessageIndex = l_44_0
UpdateDisplay()
if IsAnimatingOut == false then
IsAnimatingOut = true
AnimateCurrentOut(HandleAnimateOutComplete)
end
end
UpdateArrows()
end
UpdateArrows = function()
UpArrow._visible = false
DownArrow._visible = false
if Messages:GetCount() > 0 then
if SelectedMessageIndex > 0 then
UpArrow._visible = true
end
if SelectedMessageIndex < Messages:GetCount() - 1 and SelectedMessageIndex < MaxMessageCount - 1 then
DownArrow._visible = true
end
end
end
HandleHitTargetMousePress = function(l_46_0, l_46_1)
Objects3DHitFeedback:Press()
l_46_1.value = true
end
HandleHitTargetMouseRelease = function(l_47_0, l_47_1)
LaunchSelectedMessage()
Objects3DHitFeedback:Release()
l_47_1.value = true
end
HandleHitTargetMouseReleaseOutside = function(l_48_0, l_48_1)
Objects3DHitFeedback:Release()
l_48_1.value = true
end
LaunchSelectedMessage = function()
if _config_os == "windowsmobile" and SelectedMessageIndex >= 0 and SelectedMessageIndex < Messages:GetCount() then
local l_49_0 = Messages:GetItem(SelectedMessageIndex)
l_49_0:ShowMessageInShell()
end
end
HandleHitTargetKeyDown = function(l_50_0, l_50_1, l_50_2)
if l_50_1.Code == KeyCode_Up or l_50_1.Code == KeyCode_SwipeDown then
HandleUpArrowRelease()
l_50_2.value = true
else
if l_50_1.Code == KeyCode_Down or l_50_1.Code == KeyCode_SwipeUp then
HandleDownArrowRelease()
l_50_2.value = true
else
if l_50_1.Code == KeyCode_Return then
LaunchSelectedMessage()
l_50_2.value = true
end
end
end
end
main = function()
_request.NavigateInFrom:connect(OnNavigateIn)
_request.NavigateOutTo:connect(OnNavigateOut)
end
main()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?