📄 stock_quote.luac.lua
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;0,9,47;0,0,12,39;;0,14,15,19;0,0,0,2,34;;;0,0,10,23,24,28;0,0,6,21,25;0,0,6,21,25;0,0,6,21,25;;;;;15,36;;11,37;;13,34;;0,24,52,59,61;;;;;0,0,13;;;;;;;1; 309aac4b_manila.luac
trace("[StockQuote] stock_quote.lua begin ")
require("stock_svc")
require("InforStockListView")
require("transitions")
ItemSizeWidth = 480
ItemSizeHeight = 80
LVPositionX = 0
LVPositionY = -208
LVWidth = 480
LVHeight = 540
max_stock = 21
AddbtnVisibility = true
UserRoamingOK = false
DialogReturned_MAXStock = function(l_1_0)
l_1_0.OnExit:disconnect(DialogReturned)
error_box = false
if l_1_0.Result.ExitType == DialogExitType_OK then
trace("[StockQuote] Click OK")
InputBox:SetShowWindowFlag(true)
onsearching = false
end
end
Show_MAX_Stock = function(l_2_0)
error_box = true
InputBox:SetShowWindowFlag(false)
local l_2_1 = URL("Manila://Confirmation.dialog")
l_2_1.Parameters:AddParameter("Title", Locale:GetString("IDS_UPDATE_TITLE"))
if l_2_0 == StockType_MyPortfolio then
l_2_1.Parameters:AddParameter("ContentString", Locale:GetString("IDS_MAX_MYPORTFOLIO_WARNING"))
else
l_2_1.Parameters:AddParameter("ContentString", Locale:GetString("IDS_MAX_MARKET_WARNING"))
end
l_2_1.Parameters:AddParameter("Type", "OK")
local l_2_2 = _application.DialogManager:GetDialog(l_2_1)
l_2_2.OnExit:connect(function(l_1_0)
DialogReturned_MAXStock(l_1_0)
end)
l_2_2:Show()
end
HandleItemCreated = function(l_3_0, l_3_1)
trace("[StockQuote]~~Item create~~")
l_3_1.Tag = {}
l_3_1.Tag.Data = l_3_0
l_3_1.Focusable = true
local l_3_2 = l_3_1.Namespace:FindName("Symbol")
l_3_2.String = tostring(l_3_0.Symbol)
l_3_2.Color = GetMainTextUnselectedColor(Theme_MainTextUnselectedLevel0)
l_3_2 = l_3_1.Namespace:FindName("Name")
l_3_2.String = l_3_0.Name
l_3_2.Color = GetMainTextUnselectedColor(Theme_MainTextUnselectedLevel0)
l_3_2 = l_3_1.Namespace:FindName("Pricing")
local l_3_3 = tostring(l_3_0.Price)
if l_3_3:len() > 0 then
l_3_2.String = l_3_0.Price
l_3_2.Color = GetMainTextUnselectedColor(Theme_MainTextUnselectedLevel0)
l_3_2._visible = true
else
l_3_2._visible = false
end
if tonumber(l_3_0.Change) ~= nil then
if tonumber(l_3_0.Change) >= 0 then
l_3_2 = l_3_1.Namespace:FindName("ChangeSymbol")
l_3_2._visible = true
if RedIsUP then
l_3_2:SetTextureRef("Icon_R_Increase")
else
l_3_2:SetTextureRef("Icon_G_Increase")
end
l_3_2 = l_3_1.Namespace:FindName("Change")
l_3_2._visible = true
l_3_2.String = string.gsub(l_3_0.Change, "+", "", 3)
if RedIsUP then
l_3_2.Color = Color(190, 0, 0, 255)
else
l_3_2.Color = Color(0, 150, 0, 255)
end
else
l_3_2 = l_3_1.Namespace:FindName("ChangeSymbol")
l_3_2._visible = true
if RedIsUP then
l_3_2:SetTextureRef("Icon_G_Decrease")
else
l_3_2:SetTextureRef("Icon_R_Decrease")
end
l_3_2 = l_3_1.Namespace:FindName("Change")
l_3_2._visible = true
l_3_2.String = string.gsub(l_3_0.Change, "-", "", 3)
if RedIsUP then
l_3_2.Color = Color(0, 150, 0, 255)
else
l_3_2.Color = Color(190, 0, 0, 255)
end
end
else
l_3_2 = l_3_1.Namespace:FindName("ChangeSymbol")
l_3_2._visible = false
l_3_2 = l_3_1.Namespace:FindName("Change")
l_3_2._visible = false
end
trace("[StockQuote]~~set change end ~~")
if _StockQuotePage_ScreenRotation ~= nil then
_StockQuotePage_ScreenRotation:AdjustListviewItemLayout(l_3_0, l_3_1)
end
end
HandleItemDestroyed = function(l_4_0)
end
HandleItemSelection = function(l_5_0)
trace("[StockQuote] HandleItemSelection")
trace("[StockQuote] index = " .. l_5_0)
local l_5_1 = StockListView:GetGenerator():GetData(l_5_0)
local l_5_2 = StockType_MyPortfolio
local l_5_3 = StockManager:GetStockItemList(l_5_2)
if l_5_3:GetCount() == max_stock then
Show_MAX_Stock(l_5_2)
return
end
StockManager:AddItem(l_5_2, l_5_1)
_application.Store:SetStringValue(Lifetime_Application, "Stock.NewAddedSymbol", l_5_1.Symbol)
StockManager:Commit()
_application.Navigation:NavigateBack()
end
CreateListView = function(l_6_0, l_6_1, l_6_2)
local l_6_3 = TileLayout()
l_6_3:SetItemSize(ItemSizeWidth, ItemSizeHeight, 0)
l_6_3.SelectionNode = l_6_2
l_6_1:SetLayout(l_6_3)
if l_6_1:GetGenerator() ~= nil then
l_6_1:GetGenerator().ItemCreated:disconnect(HandleItemCreated)
l_6_1:GetGenerator().ItemDestroyed:disconnect(HandleItemDestroyed)
end
local l_6_4 = LibraryGeneratorStock(l_6_0, l_6_1:GetMovie(), l_6_1.ComponentLibraryName, l_6_1.ComponentLibraryID)
l_6_4.RecycleItems = true
l_6_4.ItemCreated:connect(HandleItemCreated)
l_6_4.ItemDestroyed:connect(HandleItemDestroyed)
l_6_1:SetGenerator(l_6_4)
l_6_1:GetGenerator().SelectedIndex = -1
end
addstock_onpress = function(l_7_0, l_7_1)
l_7_1.value = true
l_7_0:SetTextureRef("Bt_Add_press")
end
addstock_onreleaseoutside = function(l_8_0, l_8_1)
l_8_1.value = true
l_8_0:SetTextureRef("Bt_Add_rest")
end
addstock_onrelease = function(l_9_0, l_9_1)
l_9_1.value = true
l_9_0:SetTextureRef("Bt_Add_rest")
local l_9_2 = StockListView:GetGenerator():GetIndexForItem(l_9_0)
trace("[StockQuote]~~~~selected index is " .. tostring(l_9_2))
local l_9_3 = StockListView:GetGenerator():GetData(l_9_2)
local l_9_4 = StockType_MyPortfolio
local l_9_5 = StockManager:GetStockItemList(l_9_4)
if l_9_5:GetCount() == max_stock then
Show_MAX_Stock(l_9_4)
return
end
StockManager:AddItem(l_9_4, l_9_3)
_application.Store:SetStringValue(Lifetime_Application, "Stock.NewAddedSymbol", l_9_3.Symbol)
StockManager:Commit()
_application.Navigation:NavigateBack()
end
addstockhit_onpress = function(l_10_0, l_10_1)
local l_10_2 = StockListView:GetGenerator():GetIndexForItem(l_10_0)
trace("[StockQuote]~~~~selected index is " .. tostring(l_10_2))
if l_10_2 ~= -1 then
local l_10_3 = StockListView:GetGenerator():GetItem(l_10_2)
local l_10_4 = l_10_3.Namespace:FindName("AddButton")
if l_10_4 ~= nil then
addstock_onpress(l_10_4, l_10_1)
end
end
end
addstockhit_onreleaseoutside = function(l_11_0, l_11_1)
local l_11_2 = StockListView:GetGenerator():GetIndexForItem(l_11_0)
trace("[StockQuote]~~~~selected index is " .. tostring(l_11_2))
if l_11_2 ~= -1 then
local l_11_3 = StockListView:GetGenerator():GetItem(l_11_2)
local l_11_4 = l_11_3.Namespace:FindName("AddButton")
if l_11_4 ~= nil then
addstock_onreleaseoutside(l_11_4, l_11_1)
end
end
end
addstockhit_onrelease = function(l_12_0, l_12_1)
local l_12_2 = StockListView:GetGenerator():GetIndexForItem(l_12_0)
trace("[StockQuote]~~~~selected index is " .. tostring(l_12_2))
if l_12_2 ~= -1 then
local l_12_3 = StockListView:GetGenerator():GetItem(l_12_2)
local l_12_4 = l_12_3.Namespace:FindName("AddButton")
if l_12_4 ~= nil then
addstock_onrelease(l_12_4, l_12_1)
end
end
end
OnUpdatingTimer = function(l_13_0)
searching.Rotation.z = searching.Rotation.z - 36
if searching.Rotation.z < 0 then
searching.Rotation.z = searching.Rotation.z + 360
end
end
ShowUpdatingIndicator = function()
trace("[StockQuote] Show Updating Indicator\n")
searching.Opacity:Interpolate(100, 5, 0, Interpolate_EaseInQuad, nil)
if gUpdatingTimer == nil then
gUpdatingTimer = timer(0.099990844726563)
gUpdatingTimer.OnElapsed:connect(OnUpdatingTimer)
else
gUpdatingTimer:Start()
end
end
StopUpdatingIndicator = function()
onsearching = false
searching.Opacity:Interpolate(0, 5, 0, Interpolate_EaseInQuad, nil)
if gUpdatingTimer ~= nil then
gUpdatingTimer:Stop()
end
end
DialogReturned = function(l_16_0)
error_log = false
l_16_0.OnExit:disconnect(DialogReturned)
if l_16_0.Result.ExitType ~= DialogExitType_Cancel then
trace("[StockQuote] Click OK")
local x = InputBox.WindowText
if x:len() > 0 then
StockManager:SymbolSearch(x)
ShowUpdatingIndicator()
end
else
StopUpdatingIndicator()
onsearching = false
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_INFOR_BACK"), function()
StockManager:CancelAllRequests()
_application.Navigation:NavigateBack()
end))
trace("[StockQuote] Click Cancel")
end
end
Show_Error_Connection = function()
if error_log == true then
return
end
error_log = true
onsearching = true
InputBox:SetShowWindowFlag(false)
local l_17_0 = URL("Manila://Confirmation.dialog")
l_17_0.Parameters:AddParameter("Title", Locale:GetString("IDS_INFOR_ERROR_TITLE"))
l_17_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_INFOR_CONNECTION_ERROR"))
local l_17_1 = _application.DialogManager:GetDialog(l_17_0)
l_17_1.OnExit:connect(function(l_1_0)
DialogReturned(l_1_0)
end)
l_17_1:Show()
end
DialogReturned_ESymbol = function(l_18_0)
l_18_0.OnExit:disconnect(DialogReturned)
error_box = false
if l_18_0.Result.ExitType == DialogExitType_OK then
InputBox:SetShowWindowFlag(true)
onsearching = false
StopUpdatingIndicator()
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_INFOR_BACK"), function()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -