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

📄 stock_sublayer.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,0,14,45;0,7;0,25,29;0,0,0,5,21;;;;;12,33;;;;;;;;;;;0,0,11;;;;0,7,11,15;;19,25,31,34;0,7,11,15;0,4,8,12;;; 79752524_manila.luac 

require("stock_svc")
require("InforUpdating")
require("theme")
require("themecommon")
require("common")
require("ScrollPhysics")
require("transitions")
ItemSizeWidth = 480
ItemSizeHeight = 80
LVPositionX = 0
LVPositionY = 108
LVWidth = 480
LVHeight = 470
RoamingDialogReturned = function(l_1_0)
   error_log = false
   l_1_0.OnExit:disconnect(RoamingDialogReturned)
   if l_1_0.Result.ExitType ~= DialogExitType_Cancel then
     UserRoamingOK = true
     onPressUpdate()
   else
     SetupTimeUpdator()
   end
end

HandleItemCreated = function(l_2_0, l_2_1)
   trace("[StockSublayer] Item create")
   l_2_1.Tag = {}
   l_2_1.Tag.Data = l_2_0
   l_2_1.Focusable = true
   NoStockItemComponent._visible = false
   local l_2_2 = l_2_1.Namespace:FindName("Symbol")
   l_2_2.String = l_2_0.Symbol
   l_2_2.Color = GetMainTextUnselectedColor()
   l_2_2 = l_2_1.Namespace:FindName("Name")
   l_2_2.String = l_2_0.Name
   l_2_2.Color = GetMainTextUnselectedColor()
   l_2_2 = l_2_1.Namespace:FindName("Pricing")
   l_2_2.String = l_2_0.Price
   l_2_2.Color = GetMainTextUnselectedColor()
   l_2_2 = l_2_1.Namespace:FindName("ChangePercent")
   local l_2_3 = l_2_0.ChangePercent
   l_2_3 = string.gsub(l_2_0.ChangePercent, "/%", "")
   l_2_3 = string.gsub(l_2_3, "+", "")
   l_2_3 = string.gsub(l_2_3, "-", "")
   if tonumber(l_2_3) ~= nil then
      l_2_2._visible = false
      l_2_2.String = l_2_3 .. "%"
      l_2_2.Color = GetMainTextUnselectedColor()
   else
      l_2_2._visible = false
   end
   if tonumber(l_2_0.Change) ~= nil then
      if tonumber(l_2_0.Change) >= 0 then
         l_2_2 = l_2_1.Namespace:FindName("ChangeSymbol")
         l_2_2._visible = true
         if RedIsUP then
            l_2_2:SetTextureRef("Perc_Increase_Red_Bg")
            trace("[StockSublayer] Icon inc. red")
         else
            l_2_2:SetTextureRef("Perc_Increase_Green_Bg")
            trace("[StockSublayer] Icon inc. green")
         end
         l_2_2.onPress:connect(DoOnChangeSymbolPress)
         l_2_2 = l_2_1.Namespace:FindName("Change")
         l_2_2._visible = true
         l_2_2.String = string.gsub(l_2_0.Change, "+", "")
         local l_2_4 = l_2_2.String           
         if l_2_4:len() < 7 then        
            l_2_2.String = l_2_4 .. " "
         end
       else
         l_2_2 = l_2_1.Namespace:FindName("ChangeSymbol")
         l_2_2._visible = true
         if RedIsUP then
            l_2_2:SetTextureRef("Perc_Decrease_Green_Bg")
            trace("[StockSublayer] Icon dec. green")
         else
            l_2_2:SetTextureRef("Perc_Decrease_Red_Bg")
            trace("[StockSublayer] Icon dec. red")
         end
         l_2_2.onPress:connect(DoOnChangeSymbolPress)
         l_2_2 = l_2_1.Namespace:FindName("Change")
         l_2_2._visible = true
         l_2_2.String = string.gsub(l_2_0.Change, "-", "")
         local l_2_4 = l_2_2.String
         if l_2_4:len() < 7 then
            l_2_2.String = l_2_4 .. " "
         end
       end
    else
      l_2_2 = l_2_1.Namespace:FindName("ChangeSymbol")
      l_2_2._visible = false
      l_2_2 = l_2_1.Namespace:FindName("Change")
      l_2_2._visible = false
   end
   if _Stock_ScreenRotation ~= nil then
      _Stock_ScreenRotation:AdjustListviewItemLayout(l_2_0, l_2_1)
   end
end

HandleItemDestroyed = function(l_3_0)
   trace("[StockSublayer] Item destroyed~~")
   local l_3_1 = l_3_0.Namespace:FindName("ChangeSymbol")
   l_3_1.onPress:disconnect(DoOnChangeSymbolPress)
end

HandleItemSelection = function(l_4_0)
   trace("[Stock] HandleItemSelection")
   trace("[Stock] index = " .. l_4_0)
   if l_4_0 < 0 or StockListView:GetGenerator():GetCount() - 1 < l_4_0 then
      return 
   end
   local l_4_1 = StockListView:GetGenerator():GetItem(l_4_0)
   local l_4_2 = l_4_1.Namespace:FindName("Symbol")
   if l_4_2 ~= nil then
     _application.Navigation:Navigate(URL("Manila://inforwidget/stockdetail/stockdetail.page?symbol=" .. l_4_2.String), true)
   end
end

CreateListView = function(l_5_0, l_5_1, l_5_2)
   trace("[StockSublayer] crate list view ")
   local l_5_3 = TileLayout()
   l_5_3:SetItemSize(ItemSizeWidth, ItemSizeHeight, 0)
   l_5_3.SelectionNode = l_5_2
   l_5_1:SetLayout(l_5_3)
   local l_5_4 = LibraryGeneratorStock(l_5_0, l_5_1:GetMovie(), l_5_1.ComponentLibraryName, l_5_1.ComponentLibraryID)
   l_5_4.RecycleItems = false
   l_5_4.ItemCreated:connect(HandleItemCreated)
   l_5_4.ItemDestroyed:connect(HandleItemDestroyed)
   l_5_1:SetGenerator(l_5_4)
   l_5_1:GetGenerator().SelectedIndex = -1
end

TimerTimeout = function()
   UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
   if autoDownloadOn and (StockManager:GetPassThroughTime() >= nInterval or StockManager:GetPassThroughTime() < 0) then
      onPressUpdate()
   end
end

SetupTimeUpdator = function()
   remainTime = nInterval
   if TimerUpdate == nil then
      TimerUpdate = timer(60)
      TimerUpdate.OnElapsed:connect(TimerTimeout)
      TimerUpdate:Start()
   else
      TimerUpdate:Start()
   end
end

UserRoamingOK = false
onPressUpdate = function()
   if UpdateTime.String == Locale:GetString("IDS_UPDATING") then
      return 
   end
   if TimerUpdate ~= nil then
      TimerUpdate:Stop()
   end
   if not UserRoamingOK and StockManager:IsRoaming() == true and not DownloadWhenRoaming then
      if error_log == true then
         return 
      end
      error_log = true
      local url = URL("Manila://Confirmation.dialog")
      url.Parameters:AddParameter("Title", Locale:GetString("IDS_ROAM_UPDATE_DLG_TITLE"))
      url.Parameters:AddParameter("ContentString", Locale:GetString("IDS_ROAM_UPDATE_DLG_MSG"))
      local dlg = _application.DialogManager:GetDialog(url)
      dlg.OnExit:connect(function(l_1_0)
         RoamingDialogReturned(l_1_0)
      end)
      dlg:Show()
      return 
   end
   UpdateTime.String = Locale:GetString("IDS_UPDATING")
   UpdateTime.Color = Color(153, 153, 153, 255)
   txtLastUpdate._visible = false
   StartHTTPRequestTimer()
   StockManager:Update(StockType_MyPortfolio, true)
end

DialogReturned = function(l_9_0)
   error_log = false
   l_9_0.OnExit:disconnect(DialogReturned)
   if l_9_0.Result.ExitType ~= DialogExitType_Cancel then
      onPressUpdate()
   else
      SetupTimeUpdator()
   end
end

show_error = function()
   trace("[StockSublayer] show error ")
   if error_log == true then
      return 
   end
   error_log = true
   local l_10_0 = URL("Manila://Confirmation.dialog")
   l_10_0.Parameters:AddParameter("Title", Locale:GetString("IDS_INFOR_ERROR_TITLE"))
   l_10_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_INFOR_CONNECTION_ERROR"))
   local l_10_1 = _application.DialogManager:GetDialog(l_10_0)
   l_10_1.OnExit:connect(function(l_1_0)
      DialogReturned(l_1_0)
   end)
   l_10_1:Show()
end

OnQueryComplete = function(l_11_0)
   trace("[StockSublayer] ==OnQueryComplete==")
   HTTPTimer:Stop()
   UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
   UpdateTime.Color = GetMainTextUnselectedColor()
   txtLastUpdate._visible = true
   if l_11_0 == false then
      show_error()
      return 
   end
   StockManager:Commit()
   SetupTimeUpdator()
   DoUpdateAnimation()
end

HTTPTimeout = function()
   UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
   SetupTimeUpdator()
   HTTPTimer:Stop()
   StockManager:CancelAllRequests()
   show_error()
end

StartHTTPRequestTimer = function()
   trace("[StockSublayer] Start StartHTTPRequestTimer")
   if HTTPTimer == nil then
      HTTPTimer = timer(60)
      HTTPTimer.OnElapsed:connect(HTTPTimeout)
      HTTPTimer:Start()
   else
      HTTPTimer:Start()
   end
end

MenuExitCallback = function(l_14_0)
   if l_14_0.Result.ExitType ~= DialogExitType_Cancel then
      if l_14_0.Result.UserValue == "Quote" then
         StockManager:CancelAllRequests()
         local l_14_1 = StockManager:GetStockItemList(StockType_AllStocks)         
         StockManager:LoadSearchResult()         
         local l_14_2 = StockManager:GetStockItemList(StockType_Unknown)
         local l_14_3 = SymbolCollection()         
         for i1 = 0, l_14_2:GetCount() - 1 do
            local l_14_8 = l_14_2:GetItem(i1)
            local l_14_9 = true
            for i2 = 0, l_14_1:GetCount() - 1 do
               local item2 = l_14_1:GetItem(i2)
               if item2.Symbol == l_14_8.Symbol then
                 l_14_9 = false
                 break                 
               end

⌨️ 快捷键说明

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