📄 stock_detail.luac.lua
字号:
end
type_button.d1.Color = Color(255, 255, 255, 255)
end
end
end
updatechart = function(l_15_0, l_15_1, l_15_2)
if StockManager == nil then
return
end
StartHTTPRequestTimer()
UpdateTime.String = Locale:GetString("IDS_UPDATING")
txtLastUpdate._visible = false
StockManager:Chart(l_15_0, StockType_AllStocks, l_15_1, l_15_2, true)
end
showchart = function(l_16_0, l_16_1, l_16_2, l_16_3)
if StockManager == nil then
return
end
trace("~~~query chart:symbol=" .. l_16_0)
if not UserRoamingOK and StockManager:IsRoaming() == true and not DownloadWhenRoaming then
show_roaming_message()
return
end
local gss = StockManager:GetChartFromFile(l_16_0, l_16_1, l_16_2, ChartStyle_CS_WHITE)
trace("image found , set image!!")
chart:SetTexture(gss)
gss:Clear()
chart._visible = true
if StockManager:IsChartNeedUpdate(l_16_0, l_16_1, l_16_2) or l_16_3 then
updatechart(l_16_0, l_16_1, l_16_2)
return
end
end
chart_format = ChartFormat_CF_DAY
chart_vol = 1
BtnPosition = {d1 = {x = 3, y = 0, w = 64, h = 49}, d5 = {x = 67, y = 0, w = 64, h = 49}, m1 = {x = 131, y = 0, w = 64, h = 49}, m3 = {x = 195, y = 0, w = 64, h = 49}, m6 = {x = 259, y = 0, w = 64, h = 49}, y1 = {x = 323, y = 0, w = 64, h = 49}, y2 = {x = 388, y = 0, w = 64, h = 49}}
selector_position = {}
selector_position.d1 = 3
selector_position.d5 = 67
selector_position.m1 = 131
selector_position.m3 = 195
selector_position.m6 = 259
selector_position.y1 = 323
selector_position.y2 = 387
Dateview = {d1 = {text = d1, image = sprd1}, d5 = {text = d5, image = sprd5}, m1 = {text = m1, image = sprm1}, m3 = {text = m3, image = sprm3}, m6 = {text = m6, image = sprm6}, y1 = {text = y1, image = spry1}, y2 = {text = y2, image = spry2}}
type_button = {}
type_button.d1 = d1
type_button.d5 = d5
type_button.m1 = m1
type_button.m3 = m3
type_button.m6 = m6
type_button.y1 = y1
type_button.y2 = y2
chart_format_table = {}
chart_format_table.d1 = ChartFormat_CF_DAY
chart_format_table.d5 = ChartFormat_CF_DAY
chart_format_table.m1 = ChartFormat_CF_MONTH
chart_format_table.m3 = ChartFormat_CF_MONTH
chart_format_table.m6 = ChartFormat_CF_MONTH
chart_format_table.y1 = ChartFormat_CF_YEAR
chart_format_table.y2 = ChartFormat_CF_YEAR
chart_vol_table = {}
chart_vol_table.d1 = 1
chart_vol_table.d5 = 5
chart_vol_table.m1 = 1
chart_vol_table.m3 = 3
chart_vol_table.m6 = 6
chart_vol_table.y1 = 1
chart_vol_table.y2 = 2
switchType = function(l_17_0)
if UpdateTime.String == Locale:GetString("IDS_UPDATING") then
return
end
TypeSelector.Position.x = BtnPosition[l_17_0:GetInstanceName()].x
TypeSelector.Position.y = BtnPosition[l_17_0:GetInstanceName()].y
TypeSelector.Tag.obj = l_17_0
for i_1,i_2 in pairs(type_button) do
i_2.Color = Color(0, 0, 0, 255)
end
if _StockDetailPage_ScreenRotation ~= nil then
_StockDetailPage_ScreenRotation:AdjustDateItemLayout(l_17_0, TypeSelector)
else
l_17_0.Color = Color(255, 255, 255, 255)
if l_17_0:GetInstanceName() == "d1" then
TypeSelector.TextureCoords:set(0.0234375, 0.046875, 0.5234375, 0.8125)
TypeSelector:SetTextureRef("date_left_press")
else
if l_17_0:GetInstanceName() == "y2" then
TypeSelector.TextureCoords:set(0, 0.046875, 0.5, 0.8125)
TypeSelector:SetTextureRef("date_right_press")
else
TypeSelector.TextureCoords:set(0, 0.046875, 0.5, 0.8125)
TypeSelector:SetTextureRef("date_center_press")
end
end
end
chart_format = chart_format_table[l_17_0:GetInstanceName()]
chart_vol = chart_vol_table[l_17_0:GetInstanceName()]
if chart_format == ChartFormat_CF_DAY and
chart_vol == 1 then
onPressUpdate()
else
showchart(current_symbol, chart_format, chart_vol, false)
end
end
connectMouse = function()
UpdateHitArea.onPress:connect(onPressUpdate)
for i_1,i_2 in pairs(type_button) do
i_2.onPress:connect(switchType)
end
end
disconnectMouse = function()
UpdateHitArea.onPress:disconnect(onPressUpdate)
for i_1,i_2 in pairs(type_button) do
i_2.onPress:disconnect(switchType)
end
end
OnQuoteComplete = function(l_20_0, l_20_1)
if StockManager == nil then
return
end
HTTPTimer:Stop()
trace("~~OnQuoteComplete~~~")
if IsUnknown == nil then
UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
txtLastUpdate._visible = true
else
UpdateTime.String = ""
txtLastUpdate._visible = false
end
SetupTimeUpdator()
if l_20_0 == false then
show_error()
return
end
if IsUnknown == nil then
StockManager:Commit()
else
StockManager:SaveSearchResult()
end
local cs = StockManager:GetSymbol(current_symbol)
display_stock(cs)
showchart(cs.Symbol, chart_format, chart_vol, true)
end
OnPressRelatedNews = function()
YahooNewsFeedback:Press()
end
OnReleaseRelatedNews = function()
YahooNewsFeedback:Release()
if RelatednewsUrl ~= nil then
Shell_NavigateTo(ShellLocation_Opera, RelatednewsUrl)
end
end
OnReleaseOutsideRelatedNews = function()
YahooNewsFeedback:Release()
end
OnPressDetailArea = function(l_24_0)
PressLocation = l_24_0._ymouse
end
OnMouseMoveDetailArea = function(l_25_0)
local l1 = DetailStock.Position.y
if PressLocation == nil then
return
end
local l_25_2 = (l_25_0._ymouse - PressLocation) / 50
DetailStock.Position.y = l1 - l_25_2;
l1 = UpdateComponent.Position.y
UpdateComponent.Position.y = l1 - l_25_2;
StockDetailPageStable()
end
StockDetailPageStable = function()
local l_26_0 = DetailStock.Position.y
local l_26_1 = UpdateComponent.Position.y
if l_26_0 < 0 then
DetailStock.Position.y = 0
elseif l_26_0 > 321 then
DetailStock.Position.y = 321
end
if l_26_1 < 0 then
UpdateComponent.Position.y = 0
elseif l_26_1 > 321 then
UpdateComponent.Position.y = 321
end
end
start = function()
TypeSelector.Tag = {}
TypeSelector.Tag.obj = d1
TypeSelector:SetTextureRef("date_left_press")
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
trace("[StockDeletePage] : EnableLandscape")
require("Stock\\StockDetailPage_Landscape")
_StockDetailPage_ScreenRotation = StockDetailPage_ScreenRotation(Camera_2D, Mask)
end
d1.Color = Color(255, 255, 255, 255)
current_symbol = _request.URL.Parameters:GetParameter("symbol")
Symbol.String = current_symbol
stock_data = StockManager:GetSymbol(current_symbol)
if stock_data == nil or stock_data.Symbol:len() == 0 then
StockManager:LoadSearchResult()
IsUnknown = true
stock_data = StockManager:GetSymbol(current_symbol)
end
display_stock(stock_data)
image = StockManager:GetChartFromFile(current_symbol, chart_format, chart_vol, ChartStyle_CS_WHITE)
chart:SetTexture(image)
image:Clear()
chart._visible = true
YahooNewsFeedback = HitFeedback(YahooNewsGroup)
HitArea.onPress:connect(OnPressRelatedNews)
HitArea.onRelease:connect(OnReleaseRelatedNews)
HitArea.onReleaseOutside:connect(OnReleaseOutsideRelatedNews)
StockManager.OnSingleQuoteComplete:connect(OnSingleQuoteComplete)
StockManager.OnChartUpdateComplete:connect(OnChartIsReady)
StockManager.OnQuoteComplete:connect(OnQuoteComplete)
trace("Display Symbol=" .. stock_data.Symbol)
autoDownloadOn = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.AutoDownloadOff") == 0
nInterval = _application.Store:GetIntValue(Lifetime_Permanent, "StockManagerAUMInterval")
DownloadWhenRoaming = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.DownloadWhenRoaming") == 1
UpdateTime.Color = Color(153, 153, 153, 255)
if IsUnknown == nil then
UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
SetupTimeUpdator()
end
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_INFOR_BACK"), GoBack))
_application:SetRightSoftkey(Softkey("", NullFunction))
_application.OnVisibilityChanged:connect(HandleVisibilityChanged)
connectMouse()
TitleUpdateGp.Position.x = TitleUpdateGp.Position.x - 10
onPressUpdate()
end
require("transitions")
objs3D = {}
objs3D[1] = Camera_2D
setOffScreen()
NavigateOutTo = function(l_28_0)
_request.NavigateOutTo:disconnect(OnNavigateOut)
_application.OnVisibilityChanged:disconnect(HandleVisibilityChanged)
if StockManager ~= nil then
StockManager:CancelAllRequests()
end
Transition(l_28_0, "Out")
end
OnNavigateIn = function(l_29_0)
Transition(l_29_0, "In")
start()
end
_request.NavigateInFrom:connect(OnNavigateIn)
_request.NavigateOutTo:connect(NavigateOutTo)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -