-
Notifications
You must be signed in to change notification settings - Fork 0
/
doa.bas
300 lines (219 loc) · 7.75 KB
/
doa.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=6.3
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: true
#Extends: androidx.appcompat.app.AppCompatActivity
#End Region
Sub Process_Globals
Dim t As Timer
End Sub
Sub Globals
Dim ac As AppCompat
Dim act_title As Label
Private label_salavat As Label
Private zekr As ACEditText
Private taghdim_be As ACEditText
' Private beshmar As ACButton
Private pContent As Panel
Private ActionBar As ACToolBarLight
Dim bbbd As BitmapDrawable
Dim xml1 As XmlLayoutBuilder
Dim ret As String
Dim cd1 As ColorDrawable
Dim r As Reflector
Dim htj As HttpJob
Dim man As String
Private desc As Label
Dim input1 As InputDialog
Dim x1,xold As Int
Private FloatingActionButton1 As FloatingActionButton
Dim mt As KJ_MaterialToast
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("doa")
cd1.Initialize2( library.colorLight,5,2,ac.GetThemeAttribute("colorPrimary"))
' inp.Initialize("inp")
ActionBar.SetAsActionBar
ActionBar.Title = Application.LabelName
ActionBar.SetLayoutAnimated(200, 0, 0, 100%x, ac.GetMaterialActionBarHeight)
ActionBar.SetVisibleAnimated(200, True)
ac.SetElevation(ActionBar,8dip)
pContent.SetLayoutAnimated(200, 0, ActionBar.Height , 100%x, 100%y - ActionBar.Height)
pContent.SetColorAnimated(2020,Colors.White,library.colorLight)
act_title.Initialize("act_title")
act_title.Typeface = library.font
act_title.TextColor = Colors.White
act_title.Gravity = Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL)
act_title.TextSize = 18
act_title.Text = " دعا برای رزمنده ها "
ActionBar.AddView(act_title,-2,ac.GetMaterialActionBarHeight , Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL))
ActionBar.Title=""
Dim back_btn As Button
back_btn.Initialize("bb")
bbbd=xml1.GetDrawable("ic_arrow_back_white_36dp")
back_btn.SetBackgroundImage(bbbd.Bitmap)
back_btn.Gravity = Gravity.CENTER
back_btn.Text=""
ActionBar.AddView(back_btn,ac.GetMaterialActionBarHeight / 1.5 ,ac.GetMaterialActionBarHeight / 1.5 ,Bit.Or(Gravity.LEFT,Gravity.TOP))
Dim save_btn As Button
save_btn.Initialize("save_btn")
bbbd=xml1.GetDrawable("ic_check_white_24dp")
save_btn.SetBackgroundImage(bbbd.Bitmap)
save_btn.Gravity = Gravity.CENTER
save_btn.Text=""
ActionBar.AddView(save_btn,ac.GetMaterialActionBarHeight / 1.5 ,ac.GetMaterialActionBarHeight / 1.5 ,Bit.Or(Gravity.RIGHT,Gravity.TOP))
Dim saat_btn As Button
saat_btn.Initialize("saat_btn")
bbbd=xml1.GetDrawable("ic_access_alarms_white_24dp")
' bbbd.Gravity=Gravity.CENTER
saat_btn.SetBackgroundImage(bbbd.Bitmap)
saat_btn.Gravity = Gravity.CENTER
saat_btn.Text=""
ActionBar.AddView(saat_btn,ac.GetMaterialActionBarHeight / 1.5 ,ac.GetMaterialActionBarHeight / 1.5 ,Bit.Or(Gravity.RIGHT,Gravity.TOP))
label_salavat.TextColor = library.colorDark
desc.TextColor = library.colorDark
zekr.TextColor = library.colorDark
taghdim_be.TextColor = library.colorDark
zekr.HintColor = Colors.White
taghdim_be.HintColor = Colors.White
' beshmar.TextColor = Colors.White
' beshmar.color=library.colorDark
zekr.Hint = "چی میخونین؟"
taghdim_be.Hint = "اینو برای کی یا چی میخونین؟"
' zekr.SingleLine = True
' taghdim_be.SingleLine = True
label_salavat.Typeface=library.font
zekr.Typeface=library.font_tanha
taghdim_be.Typeface=library.font_tanha
desc.Typeface=library.font
If File.Exists(library.dir,"tedad_doa") Then
desc.Text = " تا حالا " & File.ReadString(library.dir,"tedad_doa").Replace(CRLF," ") & " تا دعای خیر برا رزمنده ها فرستادیم "
End If
r.Target = label_salavat
r.RunMethod3("setLineSpacing", 1, "java.lang.float",0.9, "java.lang.float")
htj.Initialize("htj",Me)
If File.Exists(library.dir,"man.txt") Then
man = File.ReadString(library.dir,"man.txt")
Else
' If library.p.SdkVersion > 16 Then
' inp.Show( "نام" , " لطفا نام خود را وارد کنید " , "اسمتون چیه؟" , "" ,False,0,"تائید","لغو","",Null,True,True )
' Else
If input1.Show("لطفا نام خود را وارد کنید","اسمتون چیه","تائید","","",Null) == DialogResponse.POSITIVE Then
File.WriteString(library.dir,"man.txt",input1.Input)
man = input1.Input
End If
' End If
End If
If File.Exists(library.dir,"taghdim_be") Then
taghdim_be.Text = File.ReadString(library.dir,"taghdim_be")
zekr.Text = File.ReadString(library.dir,"zekr")
End If
FloatingActionButton1.Icon = xml1.GetDrawable("ic_check_white_24dp")
FloatingActionButton1.Color = library.color
FloatingActionButton1.Type = FloatingActionButton1.TYPE_NORMAL
FloatingActionButton1.ShowShadow = True
FloatingActionButton1.Hide(True)
FloatingActionButton1.Top = 100%y-(FloatingActionButton1.Height*1.7)
t.Initialize("t",313)
t.Enabled=True
library.SetStatusBarColor(library.colorDark)
End Sub
Sub t_Tick
If zekr.Text.Length>3 And taghdim_be.Text.Length>3 Then
FloatingActionButton1.Show(True)
Else
FloatingActionButton1.Hide(True)
End If
End Sub
Sub pContent_Touch (Action As Int, X As Float, Y As Float)
Log(x&" : "&y&" : "&Action)
If x1 > 0 Then
If Action == 2 And x > xold And x1 < 24 Then
xold = x
If x > 202 Then
Activity.Finish
End If
End If
Else
x1 = x
xold = x
End If
End Sub
Sub inp_Input(Result As String)
File.WriteString(library.dir,"man.txt",Result)
Log(Result)
man = Result
End Sub
Sub taghdim_be_TextChanged (Old As String, New As String)
File.WriteString(library.dir,"taghdim_be",New)
End Sub
Sub zekr_TextChanged (Old As String, New As String)
File.WriteString(library.dir,"zekr",New)
End Sub
Sub yadavari_Click
Dim td As TimeDialog
Dim time As String
td.Hour = DateTime.GetHour(DateTime.Now)
td.Minute = DateTime.GetMinute(DateTime.Now)
td.Is24Hours = True
bbbd=xml1.GetDrawable("ic_access_alarms_white_24dp")
ret = td.Show("زمان مورد نظر خود را انتخاب کنید", "انتخاب زمان یادآوری", "تایید", "انصراف", "غیر فعال",bbbd.Bitmap)
If ret= DialogResponse.POSITIVE Then
time=(td.Hour*60)+td.Minute
File.WriteString(library.dir,"time",time)
File.WriteString(library.dir,"start","1")
Log(time)
StartService(timerMod)
Else If ret= DialogResponse.NEGATIVE Then
File.WriteString(library.dir,"start","0")
StopService(timerMod)
End If
End Sub
Sub saat_btn_LongClick
mt.Initialize("تنظیم ساعت یادآوری",mt.LENGTH_LONG,mt.TYPE_INFO)
End Sub
Sub saat_btn_Click
yadavari_Click
End Sub
Sub bb_LongClick
ToastMessageShow("بازگشت به صفحه قبل",False)
End Sub
Sub bb_Click
Activity.Finish
End Sub
Sub save_btn_LongClick
mt.Initialize("ثبت",mt.LENGTH_LONG,mt.TYPE_SUCCESS)
End Sub
Sub save_btn_Click
beshmar_Click
End Sub
Sub beshmar_Click
If zekr.Text.Length > 2 Then
ProgressDialogShow("لطفا کمی صبر کنید")
htj.PostString("http:https://amg-fars.ir/shohada/doa/insert.php","user="&man&"&doa="&zekr.Text&"&taghdim="&taghdim_be.Text)
Else
mt.Initialize("چی برا رزمنده ها یا شهدا میخواین بخونین ؟",mt.LENGTH_LONG,mt.TYPE_INFO)
End If
End Sub
Sub JobDone (job As HttpJob)
ProgressDialogHide
If job.Success Then
mt.Initialize("با موفقیت ثبت شد",mt.LENGTH_LONG,mt.TYPE_SUCCESS)
File.WriteString(library.dir,"tedad_doa",job.GetString.Replace(CRLF,""))
Log(job.GetString)
Dim str As RichString
str.Initialize(job.GetString.Replace(CRLF,""))
str.Color(Colors.Red,0,str.Length)
desc.Text = "تا حالا " & job.GetString.Replace(CRLF,"") & " تا دعای خیر برا رزمنده ها فرستادیم"
Activity.Finish
End If
job.Release
End Sub
Sub FloatingActionButton1_Click
beshmar_Click
End Sub