-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMX_Loading.bas
146 lines (104 loc) · 2.93 KB
/
BMX_Loading.bas
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=11.8
@EndOfDesignText@
Sub Class_Globals
Private canvas As Panel
Private EvantName As String
Private Padding As Int = 0.7%x
Private mloader As Panel
Private color As Int = 0xFF56C095
Private Radius As Int = 16
Private canvasColor As Int = 0xFFE2E2E2
Public Speed As Int = 450
Private isRunAnimation As Boolean = True
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(ev As String)
EvantName = ev
canvas.Initialize("canvas")
canvas.Background = background(canvasColor)
End Sub
Public Sub AsView As Panel
Return canvas
End Sub
'// metod
Public Sub initLib()
mloader.Initialize("mloader")
mloader.Background = background(color)
canvas.AddView(mloader,Padding,Padding,canvas.Height - (Padding * 2),canvas.Height - (Padding * 2))
' canvas.AddView(mloader,Padding,Padding,canvas.Width - (Padding *2),canvas.Height - (Padding * 2))
End Sub
Public Sub getRadiusLoader As Int
Return Radius
End Sub
Public Sub setRadiusLoader(r As Int)
Radius = r
mloader.Background = background(color)
canvas.Background = background(canvasColor)
End Sub
Public Sub setColorLoader(c As Int)
color = c
mloader.Background= background(color)
End Sub
Public Sub getColorLoader As Int
Return color
End Sub
Public Sub start
chengeRadius(True)
isRunAnimation = True
Animation
End Sub
Public Sub stop
isRunAnimation = False
Animation
End Sub
Public Sub isRun As Boolean
Return isRunAnimation
End Sub
Private Sub Animation
Do While True
If isRunAnimation = False Then
chengeRadius(False)
Exit
Else
' --------------
mloader.SetLayoutAnimated(Speed,Padding,Padding,canvas.Width - (Padding * 2),canvas.Height - (Padding * 2))'open
Sleep(Speed + 50)
' --
mloader.SetLayoutAnimated(Speed,canvas.Width -canvas.Height ,Padding,canvas.Height - (Padding ),canvas.Height - (Padding * 2))' clos right
Sleep(Speed)
chengeRadius(False)
Sleep(200)
chengeRadius(True)
mloader.SetLayoutAnimated(Speed,Padding,Padding,canvas.Width - (Padding * 2),canvas.Height - (Padding * 2))' open
Sleep(Speed)
chengeRadius(False)
Sleep(200)
chengeRadius(True)
mloader.SetLayoutAnimated(Speed,Padding,Padding,canvas.Height - (Padding * 2),canvas.Height - (Padding * 2))
Sleep(Speed)
chengeRadius(False)
Sleep(200)
chengeRadius(True)
End If
Loop
End Sub
Private Sub chengeRadius(none As Boolean)
If none Then
Dim cz As ColorDrawable
cz.Initialize(color,1 / 2)
mloader.Background = cz
Else
Dim cz As ColorDrawable
cz.Initialize(color,Radius)
mloader.Background = cz
End If
End Sub
Private Sub background(c As Int) As ColorDrawable
Dim cz As ColorDrawable
cz.Initialize(c,Radius)
Return cz
End Sub