-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading.lua
57 lines (49 loc) · 1.16 KB
/
loading.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require "import"
import "theme"
--import "mengchen"
import "loading_layout"
activity.setContentView(loadlayout("loading_layout"))
function onKeyDown(code,event)
if string.find(tostring(event),"KEYCODE_BACK") ~= nil then
return true
end
end
function skip.onClick()
activity.finish()
end
function run_ti()
if num == nil then
num = 4
ti = Ticker()
ti.Period = tonumber(1000)
function ti.onTick()
text.Text = "跳过 "..num
num = num - 1
if num == -1 then
activity.finish()
end
end
ti.start()
end
end
function loading()
urla="https://www.mini1.cn/mobile/"
Http.get(urla,nil,nil,nil,function(code,content)
if code==200 then
file = io.open("/sdcard/devToolbox/loading.html","w")
file:write(content)
file:close()
file = "/sdcard/devToolbox/loading.html"
loading_lines={}
for line in io.lines(file) do
table.insert(loading_lines,line)
end
image_url = loading_lines[49]:match([[<img src="(.-)" class="bannerimg" alt="" />]])
loading_image.setImageBitmap(loadbitmap(image_url))
run_ti()
else
run_ti()
end
end)
end
loading()