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

📄 weathercitypicker.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 2 页
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;0,4;;;0,10,20;;;;;;;0,24;;;0,0,16;;;;81;;0,0,3;;;;;;;;0,1;;; 38081241_manila.luac 

require("theme")
require("hitfeedback")
CityPicker_HandleKeyDown = function(l_1_0)
   trace("Entering CityPicker_HandleKeyDown\n")
   local l_1_1 = nil
   if l_1_0.Code == KeyCode_Return or l_1_0.Code == KeyCode_Space then
      if CountryPickerList._visible == true then
         trace("Received DPAD center press while the country picker list was visible\n")
         l_1_1 = CountryPickerList:GetGenerator().SelectedIndex
         trace("DPAD center button click was received for country list index: " .. l_1_1 .. "\n")
         HandleCountryListSeletion(l_1_1)
      else
         if CityPickerList._visible == true then
            trace("Received DPAD center press while the city picker list was visible\n")
            l_1_1 = CityPickerList:GetGenerator().SelectedIndex
            trace("DPAD center button click was received for city list index: " .. l_1_1 .. "\n")
            HandleCityListSelection(l_1_1)
         end
      end
   end
   trace("Exiting CityPicker_HandleKeyDown\n")
end

DoDeleteCityList = function()
   CityPickerList:SetGenerator(LibraryGeneratorint(VectorNotifyint(), CityPickerList:GetMovie(), CityPickerList.ComponentLibraryName, CityPickerList.ComponentLibraryID))
   CityPickerList.onUpdate:disconnect(DoDeleteCityList)
end

HandleCityListSelection = function(l_3_0)
   if l_3_0 < 0 then
      return 
   end
   trace("Selected Index: " .. CityPickerList:GetGenerator().SelectedIndex .. "\n")
   BackCountryIndex = nil
   if _config_os == "windowsmobile" then
      local l_3_1 = CityPickerList:GetGenerator():GetData(CityPickerList:GetGenerator().SelectedIndex)
      local l_3_2 = -1
      for i = 1, cityListSize do
         if cityList[i].accuweatherCode == l_3_1.accuweatherCode then
            l_3_2 = i
            break
          end
      end
      if l_3_2 ~= -1 then
         currentCity = l_3_2
      else
         cityListSize = cityListSize + 1
         currentCity = cityListSize
         cityList[currentCity] = weather:GetCityFromCode(l_3_1.accuweatherCode)
         PersistCityList()
         trace("CityName: " .. l_3_1.cityName .. "\n")
         trace("AccuWeatherCode: " .. l_3_1.accuweatherCode .. "\n")
         TemperatureHundreds.String = ""
         TemperatureTens.String = ""
         TemperatureOnes.String = ""
         TemperatureDegrees.String = ""
         Location.String = GetDisplayName(cityList[currentCity])
         Condition.String = ""
         HighLabel.String = ""
         LowLabel.String = ""
         HighTemp.String = ""
         LowTemp.String = ""
         RealWeatherIcon._visible = false
      end
      forecastMinutes = -1
      SwitchMode("Gizmo")
      PerformUpdateOnSelectedCity(currentCity)
   else
   end
   handled = true   
   CityPickerList.onUpdate:connect(DoDeleteCityList)
end

PerformUpdateOnSelectedCity = function(l_4_0)
   local l_4_1 = _application.Store:GetIntValue(Lifetime_Permanent, "Data.AutoDownloadOff") == 0
   local l_4_2 = _application.Store:GetIntValue(Lifetime_Permanent, "Data.DataChargeWarnings") ~= 0
   if l_4_2 == true then
     if l_4_1 == true then
        DoBeginGetForecast(cityList[l_4_0], false)
     else
        ShowDataChargeConfirmationDialog(function()
          DoBeginGetForecast(cityList[l_4_0],false)
        end)
     end
   else
      skiperrorbox = true
      DoBeginGetForecast(cityList[l_4_0], false)
   end
end

HandleCityListItemSelection = function(l_5_0)
   l_5_0.Namespace:FindName("CityText").Color = GetMainTextSelectedColor()
end

HandleCityListItemDeselection = function(l_6_0)
   l_6_0.Namespace:FindName("CityText").Color = GetMainTextUnselectedColor()
end

HandleCityListItemCreation = function(l_7_0, l_7_1)
   l_7_1.Focusable = true
   l_7_1.OnSelected:connect(HandleCityListItemSelection)
   l_7_1.OnDeselected:connect(HandleCityListItemDeselection)
   local ct = l_7_1.Namespace:FindName("CityText")
   ct.Color = GetMainTextUnselectedColor()
   if _config_os == "windowsmobile" then
      if l_7_0.state ~= "" then
         ct.String = l_7_0.cityName .. ", " .. l_7_0.state
      else
         ct.String = l_7_0.cityName
      end
   else
      ct.String = "test" .. l_7_0
   end
end

HandleCityListItemDestruction = function(l_8_0)
   l_8_0.OnSelected:disconnect(HandleCityListItemSelection)
   l_8_0.OnDeselected:disconnect(HandleCityListItemDeselection)
end

GoBackFromCityToCountry = function()
   InputBoxDefaultText._visible = true
   InputBox:SetShowWindowFlag(false)
   CityPickerList._visible = false
   CityPickerListScrollPhysics:DisconnectMouseEvents()
   SwitchMode("CityPicker")
end

DoDeleteCountryList = function()
   CountryPickerList:SetGenerator(LibraryGeneratorint(VectorNotifyint(), CountryPickerList:GetMovie(), CountryPickerList.ComponentLibraryName, CountryPickerList.ComponentLibraryID))
   CountryPickerList.onUpdate:disconnect(DoDeleteCountryList)
end

HandleCountryListSeletion = function(l_11_0)
   if l_11_0 < 0 then
      return 
   end
   CountryPickerList._visible = false
   BackCountryIndex = l_11_0
   if objLetterPicker then
      objLetterPicker:Reset()
   end
   if _config_os == "windowsmobile" then
      local l_11_1 = CountryPickerList:GetGenerator():GetData(CountryPickerList:GetGenerator().SelectedIndex)
      currentCountry = l_11_1.country
      citySearchString = ""
      itemListGenerator = LibraryGeneratorCity(weather:SearchCitiesInCountry(citySearchString, l_11_1.country, 5000), CityPickerList:GetMovie(), CityPickerList.ComponentLibraryName, CityPickerList.ComponentLibraryID)
      itemListGenerator.RecycleItems = true
      itemListGenerator.ItemCreated:connect(HandleCityListItemCreation)
      itemListGenerator.ItemDestroyed:connect(HandleCityListItemDestruction)
      CityPickerList:SetGenerator(itemListGenerator)
      CityPickerList._visible = true
      CountryPickerListScrollPhysics:DisconnectMouseEvents()
      CityPickerListScrollPhysics:ConnectMouseEvents()
      CityPickerList:ForceLayout()
      CityPickerList:Focus()
      _application.Navigation.Title = "[[IDS_SELECTCITY]]"
      CountryPickerList.onUpdate:connect(DoDeleteCountryList)
      _application:SetLeftSoftkey(Softkey("", nil))
      _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_BACK"), GoBackFromCityToCountry))
      InputBoxDefaultText._visible = true
      InputBox:SetShowWindowFlag(false)
      InputBoxFlag = true
      InputBox.WindowText = ""
   end
end

HandleCountryListItemSelection = function(l_12_0)
   l_12_0.Namespace:FindName("CityText").Color = GetMainTextSelectedColor()
end

HandleCoutryListItemDeselection = function(l_13_0)
   l_13_0.Namespace:FindName("CityText").Color = GetMainTextUnselectedColor()
end

HandleCountryListItemCreation = function(l_14_0, l_14_1)
   trace("handleCountryListItemCreation\n")
   l_14_1.Focusable = true
   l_14_1.OnSelected:connect(HandleCountryListItemSelection)
   l_14_1.OnDeselected:connect(HandleCoutryListItemDeselection)
   local l_14_2 = l_14_1.Namespace:FindName("CityText")
   trace(l_14_0.country)
   l_14_2.Color = GetMainTextUnselectedColor()
   if _config_os == "windowsmobile" then
      l_14_2.String = l_14_0.country
   else
      l_14_2.String = "test" .. l_14_0
      trace("Data: " .. l_14_0 .. "\n")
   end
end

HandleCountryListItemDestruction = function(l_15_0)
   l_15_0.OnSelected:disconnect(HandleCountryListItemSelection)
   l_15_0.OnDeselected:disconnect(HandleCoutryListItemDeselection)
end

CancelCountryList = function()
   InputBox:SetShowWindowFlag(false)
   CountryPickerList._visible = false
   SwitchMode("Gizmo")
end

onCityPickerKeyDown = function(l_17_0, l_17_1, l_17_2)
   if l_17_1.Code == KeyCode_Back then
      if CityPickerList._visible == true then
         GoBackFromCityToCountry()
         l_17_2.value = true
      else
         if CountryPickerList._visible == true then
            CancelCountryList()
            l_17_2.value = true
         end
      end
   end
end

KeyboardHandler.onKeyUp:connect(onCityPickerKeyDown)
InitializeCountryList = function()
   trace("setting initialize stuff\n")
   countrySearchString = ""
   countryitemListGenerator = LibraryGeneratorCity(weather:GetCountryList(), CountryPickerList:GetMovie(), CountryPickerList.ComponentLibraryName, CountryPickerList.ComponentLibraryID)
   countryitemListGenerator.RecycleItems = true
   countryitemListGenerator.ItemCreated:connect(HandleCountryListItemCreation)
   countryitemListGenerator.ItemDestroyed:connect(HandleCountryListItemDestruction)
   CountryPickerList:SetGenerator(countryitemListGenerator)
   trace("done initialize stuff\n")
   _application.Navigation.Title = "[[IDS_SELECTCOUNTRY]]"

⌨️ 快捷键说明

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