weathergizmo.luac.lua
来自「htc manila 2 sourcecode」· LUA 代码 · 共 1,279 行 · 第 1/3 页
LUA
1,279 行
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;0,11,32;;0,17,38;;;;;;;;;1;;0,3,6,16,26;0,34;14,35;;;0,0,4,10,14;;;;;;;49,100,223;;0,0,223;;;32,40;;;;;;;;;;;;;;19;;0,0,5;8;;;;; 27a13690_manila.luac
weathergizmo_loaded = true
animatingUpOrDown = false
forecastMinutes = -1
allowUnlimitedForcedUpdates = _application.Store:GetIntValue(Lifetime_Permanent, "Weather.AllowUnlimitedForcedUpdates")
declinedRetry = false
functionForAfterOnNavigateIn = nil
navigatingIn = true
forceRoaming = false
resetSoftkeysOnDialogExit = false
loadedCity = false
navigatingOut = false
skiperrorbox = false
gbDetailConnet = false
drawForecastTimerInterval = 2
drawForecastData = nil
drawForecastTimer = nil
UpdateStatus = 1
if CityNumberSeperator == nil then
CityNumberSeperator = "/"
end
OnShowUpdateNowConfirmationDialogReturned = function(l_1_0, l_1_1)
l_1_0.OnExit:disconnect(OnShowUpdateNowConfirmationDialogReturned)
if l_1_0.Result.ExitType ~= DialogExitType_Cancel then
if currentMode ~= "Gizmo" then
SwitchMode("Gizmo")
end
forceRoaming = true
l_1_1()
else
end
end
ShowUpdateNowConfirmationDialog = function(l_2_0)
if EasterEggRunning == true then
return
end
if navigatingOut == true then
return
end
local l_2_1 = URL("Manila://Confirmation.dialog")
l_2_1.Parameters:AddParameter("Title", Locale:GetString("IDS_YOU_ARE_ROAMING"))
l_2_1.Parameters:AddParameter("ContentString", Locale:GetString("IDS_UPDATE_NOW_DLG_MSG"))
local l_2_2 = _application.DialogManager:GetDialog(l_2_1)
l_2_2.OnExit:connect(function(l_1_0)
OnShowUpdateNowConfirmationDialogReturned(l_1_0, l_2_0)
end)
l_2_2:Show()
end
OnShowDataChargeConfirmationDialogReturned = function(l_3_0, l_3_1)
trace("Entering OnShowDataChargeConfirmationDialogReturned\n")
l_3_0.OnExit:disconnect(OnShowUpdateNowConfirmationDialogReturned)
if l_3_0.Result.ExitType ~= DialogExitType_Cancel then
if currentMode ~= "Gizmo" then
SwitchMode("Gizmo")
end
forceRoaming = true
l_3_1()
else
trace("The user did not confirm the update download task\n")
end
trace("Exiting OnShowDataChargeConfirmationDialogReturned\n")
end
ShowDataChargeConfirmationDialog = function(l_4_0)
trace("Entering ShowDataChargeConfirmationDialog\n")
trace("Presenting user with a dialog that confirms download despite possible data charges\n")
if EasterEggRunning == true then
return
end
if navigatingOut == true then
return
end
local l_4_1 = URL("Manila://Confirmation.dialog")
l_4_1.Parameters:AddParameter("Title", Locale:GetString("IDS_DATA_CHARGE_TITLE"))
l_4_1.Parameters:AddParameter("ContentString", Locale:GetString("IDS_DATA_CHARGE_MSG"))
local l_4_2 = _application.DialogManager:GetDialog(l_4_1)
l_4_2.OnExit:connect(function(l_1_0)
OnShowDataChargeConfirmationDialogReturned(l_1_0, l_4_0)
end)
l_4_2:Show()
trace("Exiting ShowDataChargeConfirmationDialog\n")
end
OnLoadGetForecasts = function(l_5_0)
if l_5_0 == nil then
l_5_0 = false
end
DoBeginGetForecast(cityList[currentCity], l_5_0)
Location.String = GetDisplayName(cityList[currentCity])
for i = 1, cityListSize do
if i ~= currentCity then
weather:BeginGetForecast(cityList[i], l_5_0, onBeginGetForecastCompletion)
end
end
end
ForceUpdate = function(l_6_0, l_6_1, l_6_2)
if l_6_2 == nil then
l_6_2 = false
end
if l_6_2 == true or
(forecastMinutes >= 1 or allowUnlimitedForcedUpdates == 1) and getForecastTimer == nil then
declinedRetry = false
if cityListSize > 0 then
LastUpdateLabel.String = "[[IDS_LOADING]]"
CityNumberGroup._visible = false
DoBeginGetForecast(cityList[currentCity], l_6_2)
Location.String = cityList[currentCity].cityName
for i = 1, cityListSize do
if i ~= currentCity then
weather:BeginGetForecast(cityList[i], l_6_2, onBeginGetForecastCompletion)
end
end
else
SwitchMode("NoCities")
end
end
if l_6_1 ~= nil then
l_6_1.value = true
end
end
UpdateCityCount = function()
if EasterEggRunning == true then
return
end
if cityListSize == 0 or cityListSize == 1 then
CityNumberGroup._visible = false
else
if currentMode ~= "CityPicker" then
CityNumberGroup._visible = true
end
CityNumber.String = tostring(currentCity) .. " " .. CityNumberSeperator .. " " .. tostring(cityListSize)
end
end
OnNavigateIn = function(l_8_0)
require("playcontrol")
require("weathericon")
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
require("Weather\\Weather_Landscape")
_Weather_ScreenRotation = Weather_ScreenRotation()
end
_request.NavigateInFrom:disconnect(OnNavigateIn)
Transition(l_8_0, "In")
end
OnNavigateOut = function(l_9_0)
EasterEggHitDetector.onRelease:disconnect(EasterEggRelease)
InputBox:SetShowWindowFlag(false)
navigatingOut = true
_request.NavigateOutTo:disconnect(OnNavigateOut)
_application.Store:SetIntValue(Lifetime_Permanent, "Weather.CurrentCity", currentCity)
if drawForecastTimer ~= nil then
drawForecastTimer:Stop()
drawForecastTimer = nil
end
if drawForecastData ~= nil then
drawForecastData = nil
end
if CountryPickerList._visible == true or CityPickerList._visible == true or EasterEggRunning == true then
_application.Navigation.TabVisibility = true
end
Transition(l_9_0, "Out")
if sprCover ~= nil then
sprCover.onPress:disconnect(HandleEatsEventsCover)
sprCover.onRelease:disconnect(HandleEatsEventsCover)
sprCover.onReleaseOutside:disconnect(HandleEatsEventsCover)
trace("disconnect sprCover......\n")
end
end
OnPageInit = function()
require("weather_svc")
require("weather")
require("weathereasteregg")
require("machine_status_svc")
require("weathercitypicker")
require("weathercityLocalTime")
_request.PageInit:disconnect(OnPageInit)
OnPageInit1()
Transition("Arbitrary", "In")
end
OnPostPageInit = function()
require("scrollphysics")
_request.PostPageInit:disconnect(OnPostPageInit)
trace("OnPostPageInit...\n")
Separator._visible = true
_celsius = _application.Store:GetIntValue(Lifetime_Permanent, "Weather.Fahrenheit") == 0
OnPostPageInit1()
OnPostPageInit3()
OnPostPageInit2()
Transition("Arbitrary", "In")
end
require("playcontrol")
require("weathericon")
StopAll(GizmoRoot)
InitializeWeatherIcon(RealWeatherIcon)
if _config_os == "windowsmobile" then
_request.NavigateOutTo:connect(OnNavigateOut)
_request.NavigateInFrom:connect(OnNavigateIn)
_request.PageInit:connect(OnPageInit)
_request.PostPageInit:connect(OnPostPageInit)
end
require("transitions")
objs3D = {}
objs3D[1] = GizmoGroup
objs3D[2] = EasterEggComponent
objs3D[3] = IconGroup
objs2D = {}
objs2D[1] = Group2D
TransitionComplete = function(l_12_0)
if l_12_0 == "In" then
if UpdateStatus == 1 then
CityNumberGroup._visible = false
end
transitionDelayStart(l_12_0)
return
end
trace("*** Navigate Complete in weather.m9 ***")
if l_12_0 == "Out" then
EasterEggHitDetector.onRelease:disconnect(EasterEggRelease)
end
if l_12_0 ~= "In" then
UpdateCityCount()
end
transitionDelayStart(l_12_0)
if functionForAfterOnNavigateIn ~= nil then
navigatingIn = false
functionForAfterOnNavigateIn()
functionForAfterOnNavigateIn = nil
end
end
setOffScreen()
ShowMenu = function()
local l_13_0 = ""
if cityListSize >= 10 then
l_13_0 = "nocities"
end
if _celsius == true then
dialogThing = _application.DialogManager:GetDialog(URL("Manila://weatherf" .. l_13_0 .. ".dialog"))
else
dialogThing = _application.DialogManager:GetDialog(URL("Manila://weatherc" .. l_13_0 .. ".dialog"))
end
dialogThing.OnExit:connect(OnMenuExit)
dialogThing:Show()
end
SetGizmoSoftkeys = function()
if navigatingOut == false then
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_UPDATE_NOW_CONF_DLG_TITLE"), function()
ForceUpdateWithUserConfirmation(true)
end))
_application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), ShowMenu))
end
end
ForceUpdateWithUserConfirmation = function(l_15_0)
local l_15_1 = weather:IsRoaming()
local l_15_2 = weather:DownloadWhenRoaming()
local l_15_3 = _application.Store:GetIntValue(Lifetime_Permanent, "Data.AutoDownloadOff") == 0
local l_15_4 = _application.Store:GetIntValue(Lifetime_Permanent, "Data.DataChargeWarnings") ~= 0
if l_15_1 == true and l_15_2 == false and forceRoaming == false then
ShowUpdateNowConfirmationDialog(function()
ForceUpdate(nil, nil, true)
end)
return
end
if l_15_0 == true and l_15_3 == false and l_15_4 == true then
ShowDataChargeConfirmationDialog(function()
ForceUpdate(nil, nil, true)
end)
return
end
ForceUpdate(nil, nil, true)
end
OnShowConnectionErrorDialogReturned = function(l_16_0)
_application.TouchFlo.HorizontalEnabled = true
_application.TouchFlo.VerticalEnabled = true
l_16_0.OnExit:disconnect(OnShowConnectionErrorDialogReturned)
if currentMode ~= "Gizmo" then
SwitchMode("Gizmo")
end
if l_16_0.Result.ExitType ~= DialogExitType_Cancel then
ForceUpdate(nil, nil, true)
else
LastUpdateLabel.String = "[[IDS_LASTUPDATELABEL]]"
local l_16_1 = weather:GetForecast(cityList[currentCity])
if l_16_1 == nil then
trace("no weather data!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11")
SetViewToGizmoMode(2)
else
SetViewToGizmoMode(3)
local cond = l_16_1.currentConditions
RealWeatherIcon._visible = true
SetWeatherIconState(RealWeatherIcon, cond.condition)
if animatingUpOrDown == false then
SetNewCityInfo()
end
ShowForecast(l_16_1)
end
declinedRetry = true
end
end
ShowConnectionErrorDialog = function()
if EasterEggRunning == true then
return
end
if navigatingOut == true then
return
end
weather:CancelAllRequests()
local l_17_0 = URL("Manila://Confirmation.dialog")
l_17_0.Parameters:AddParameter("Title", Locale:GetString("IDS_CONNECTION_ERROR_TITLE"))
l_17_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_CONNECTION_ERROR_MSG"))
local l_17_1 = _application.DialogManager:GetDialog(l_17_0)
l_17_1.OnExit:connect(OnShowConnectionErrorDialogReturned)
l_17_1:Show()
end
SetViewToGizmoMode = function(l_18_0)
trace("@@@### UpdateStatus = " .. l_18_0 .. " , CurrentMode = " .. currentMode .. "%%%%%%%%%%%%%%%%%%%%")
UpdateStatus = l_18_0
if currentMode == "Gizmo" then
GizmoView._visible = true
UpdateConditionText()
if l_18_0 == 1 then
LoadingGroup._visible = true
NoDataGroup._visible = false
RealWeatherIcon._visible = false
WeatherData._visible = false
WeatherForecast._visible = false
LastUpdateMinAgo._visible = false
LastUpdateLabel.String = "[[IDS_LOADING]]"
CityNumberGroup._visible = false
elseif l_18_0 == 2 then
LoadingGroup._visible = false
NoDataGroup._visible = true
RealWeatherIcon._visible = false
WeatherData._visible = false
WeatherForecast._visible = false
LastUpdateMinAgo._visible = false
CityNumberGroup._visible = true
UpdateCityCount()
else
LoadingGroup._visible = false
NoDataGroup._visible = false
RealWeatherIcon._visible = true
WeatherForecast._visible = true
WeatherData._visible = true
LastUpdateMinAgo._visible = true
CityNumberGroup._visible = true
UpdateCityCount()
end
else
LoadingGroup._visible = false
NoDataGroup._visible = false
GizmoView._visible = false
end
end
SwitchMode = function(l_19_0)
if EasterEggRunning == true then
return
end
InputBoxFlag = true
InputBox.WindowText = ""
InputBox._visible = false
Text_bg._visible = false
InputBoxDefaultText._visible = false
CityPickerList._visible = false
CountryPickerList._visible = false
LetterPickerGroup._visible = false
ProblemGroup._visible = false
IsScrollable = false
CityNumberGroup._visible = false
IsClick = false
_application:HideInputPanel()
CityPickerListScrollPhysics:DisconnectMouseEvents()
CountryPickerListScrollPhysics:DisconnectMouseEvents()
if l_19_0 == "CityPicker" then
InputBox._visible = true
Text_bg._visible = true
InputBoxDefaultText._visible = true
if objLetterPicker then
objLetterPicker:Reset()
end
_application.TouchFlo.HorizontalEnabled = false
_application.TouchFlo.VerticalEnabled = false
CityNumberGroup._visible = false
IconGroup._visible = false
LastUpdateLabel._visible = false
LastUpdateMinAgo._visible = false
_application.Navigation.TabVisibility = false
currentMode = "CityPicker"
SetViewToGizmoMode(UpdateStatus)
StartCityPicker()
InitializeCountryList()
CountryPickerList._visible = true
CountryPickerListScrollPhysics:ConnectMouseEvents()
CountryPickerList:ForceLayout()
CountryPickerList:Focus()
_application:SetLeftSoftkey(Softkey("", nil))
_application:SetRightSoftkey(Softkey(Locale:GetString("IDS_CANCEL"), CancelCountryList))
local dra = _application.Store:GetIntValue(Lifetime_Permanent, "Weather_DisableRandomAccess")
if dra == 1 then
trace("[Weather] : Disable random access")
else
trace("[Weather] : Enable random access")
LetterPickerGroup._visible = true
if not objLetterPicker then
require("weatherletterpicker")
end
end
elseif l_19_0 == "NoCities" then
_application.TouchFlo.HorizontalEnabled = true
_application.TouchFlo.VerticalEnabled = true
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?