Type=StaticCode
Version=4.3
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.
Dim mp1,mpGame1 As MediaPlayer
End Sub

Sub playAnimation(obj1 As View,sAction As String,sSpeed As Int)
Dim animation1 As Animation
    Select Case sAction
	 Case "rotate"
	  animation1.InitializeRotateCenter("",0,360,obj1)
	 Case "scale"
	  animation1.InitializeScaleCenter("",1,1,0.2,0.2,obj1)
	 Case "scale1"
	  animation1.InitializeScaleCenter("",-3,-3,0,0,obj1)	  
	 Case "alpha"
	  animation1.InitializeAlpha("",0,100)
	 Case "translate"
	  animation1.InitializeTranslate("",0,0,obj1.Left,obj1.Top)
	End Select
	animation1.RepeatCount = 0
	animation1.Duration = sSpeed
	DoEvents
	animation1.Start(obj1)
	DoEvents
End Sub

Sub playAudio(sFile As String)
Try
 mp1.Initialize2("")
 mp1.load(File.DirAssets,sFile)
 mp1.Play
Catch
Log(LastException.Message)
End Try
End Sub

Sub playAudioNumber(sNumber As String)
Dim sFilename As String
Dim media As MediaPlayer
Dim threat1 As Thread
Dim i,j As Int
threat1.Initialise("")
Try
    media.Initialize2("mp2")
	If (sNumber Mod 10 = 0) Then
	 sFilename = sNumber & ".mp3"
	 media.Load(File.DirAssets,"fa_" & sFilename)
	 media.Play
	Return
	End If
	If sNumber > 19 Then
		 i = sNumber Mod 10
		 j = Floor((sNumber / 10)) * 10
		 sFilename = j & "_.mp3"
		 media.Load(File.DirAssets,"fa_" & sFilename)
		 media.Play
		 threat1.Sleep(700)
		 sFilename = i & ".mp3"
		 media.Load(File.DirAssets,"fa_" & sFilename)
		 media.Play 
	Else
		 sFilename = "fa_" & sNumber & ".mp3"
		 media.Load(File.DirAssets, sFilename)
		 media.Play
	End If
Catch
 Msgbox("این قابلیت در نسخه بعدی فعال خواهد شد","خطا")
End Try
End Sub
Sub changeTheme(img1 As ImageView)
Dim s1 As String
s1 = settings.getData("settingApp.app","theme")
If s1 <> "" AND File.Exists(File.DirAssets,s1) = True Then
 img1.Bitmap = LoadBitmap(File.DirAssets,s1)
End If
End Sub
Sub vibrePhone
Dim i1 As PhoneVibrate
i1.Vibrate(1100)
End Sub
Sub stopAudio
Try
 mpGame1.Stop
Catch
End Try
End Sub
Sub playbgGame1
Try
Dim s1,s2 As String
 s1 = settings.getData("settingApp.app","muteBG")
 s2 = settings.getData("settingApp.app","audioBG")
 If s1 <> "true" Then
   mpGame1.Initialize2("")
   If s2 = "" Then
    mpGame1.load(File.DirAssets,"bg.mp3")
   Else If s2 <> "" AND File.Exists(File.DirInternal,s2) = True Then
    mpGame1.load(File.DirInternal,s2)
   Else
    mpGame1.load(File.DirAssets,"bg.mp3")
   End If
   mpGame1.Play
 End If
Catch
 Log(LastException.Message)
End Try
End Sub
Sub ShuffleArray(arr() As String)
Dim n As Int = arr.Length-1
Dim r As Int
Dim t As String
For i = 0 To n - 1
    r = Rnd(i, n)
    t = arr(i)
    arr(i) = arr(r)
    arr(r) = t
Next
End Sub
Sub getItemSql As List
Dim l1 As List
l1.Initialize
Dim i As Int
Dim s1 As SQL
Dim c1 As Cursor
If File.Exists(File.DirInternal,"book.db") = False Then
  File.Copy(File.DirAssets,"book.db",File.DirInternal,"book.db")
End If
s1.Initialize(File.DirInternal,"book.db",False)
c1 = s1.ExecQuery("SELECT sQuestion,sAnswer FROM tbl_data")
i = Rnd(0,c1.RowCount-1)
c1.Position = i
l1.Add(c1.GetString("sQuestion"))
l1.Add(c1.GetString("sAnswer"))
c1.Close
s1.Close
Return l1
End Sub