'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sp As SoundPool
Dim waterDrop, bellSound, buzzerSound As Int
Dim hc As HttpClient
Dim Question_LIST, user_LIST As Int
Question_LIST = 1
user_LIST = 2
End Sub
Sub Globals
Dim pnlPage1, pnlPage2, pnlPage3, pnlProfile As Panel ' Declares the three panels
Dim pnlToolbox, pnlAnswerGroup, pnlAnsResult As Panel
Dim btnResult, btnSubmitAns As Button
Dim lblAnsResult, lblQuestion As Label
Dim lblProfileUsername, lblProfileName, lblProfileSchool, lblProfileHomeroom, lblProfileGrade, lblProfileMSOLevel As Label
Dim CurrentQuestionNumber As Int: CurrentQuestionNumber = 0
Dim chosenAnsBtn As Int: chosenAnsBtn = 0
Dim radioBtnAnswer1, radioBtnAnswer2, radioBtnAnswer3, radioBtnAnswer4 As RadioButton
Dim ScrollView1 As ScrollView
Dim edtxtUserName As EditText
Dim edtxtPassword As EditText
Dim RadioButton1 As RadioButton
Dim anim1 As Animation
Type typeQuestion( _
Question As String, correctAnswer As String, _
Answer1 As String, Answer2 As String, Answer3 As String, Answer4 As String)
Type typeProfile( _
userID As Int, userName As String, firstName As String, _
lastName As String, school As String, schoolGrade As String, msoLevel As String, homeroom As String)
Dim currentQuestion As typeQuestion
Dim userProfile As typeProfile
Dim listQuestions As List
listQuestions.Initialize
Dim correctAnsBMP As Bitmap
correctAnsBMP.Initialize(File.DirAssets,"greenResultBKG.png")
Dim wrongAnsBMP As Bitmap
wrongAnsBMP.Initialize(File.DirAssets,"wronganswer.png")
Dim btnLoginTryAgain As Button
Dim pnlLoginFailed As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
sp.Initialize(4)
waterDrop = sp.Load(File.DirAssets, "WaterDrop.mp3")
bellSound = sp.Load(File.DirAssets, "bell.mp3")
buzzerSound = sp.Load(File.DirAssets, "buzzer.mp3")
End If
pnlAnswerGroup.Initialize(pnlAnswerGroup)
RadioButton1.Initialize(RadioButton1)
RadioButton1.Text = "And now for a message from our sponsors. Buy Coke, you'll rot your teeth out in less than two months. Just think of the advantages to your life. You will never have to brush your teeth again, and that will save you four minutes a day!"
Activity.LoadLayout("Main") ' Loads "Main" layout file
' FetchQuestionsList
pnlPage1.Initialize("") ' Initializes pnlPage1
pnlPage1.LoadLayout("Page1") ' Loads "Page1" layout file
Activity.AddView(pnlPage1,0,0,100%x,100%y) ' Adds pnlPage1
pnlPage1.Visible=True ' Sets pnlPage1 to Visible
pnlPage2.Initialize("") ' Initializes pnlPage2
pnlPage2.LoadLayout("Page2") ' Loads "Page2" layout file
Activity.AddView(pnlPage2,0,0,100%x,100%y) ' Adds pnlPage2
pnlPage2.Visible=False ' Sets pnlPage1 to invisible
pnlPage3.Initialize("") ' Initializes pnlPage3
pnlPage3.LoadLayout("Page3") ' Loads "Page3" layout file
Activity.AddView(pnlPage3,0,0,100%x,100%y) ' Adds pnlPage3
pnlPage3.Visible=False ' Sets pnlPage1 to invisible
pnlProfile.Initialize("") ' Initializes pnlPage3
pnlProfile.LoadLayout("profile") ' Loads "profile" layout file
Activity.AddView(pnlProfile,0,0,100%x,100%y) ' Adds pnlProfile
pnlProfile.Visible=False ' Sets pnlPage1 to invisible
Activity.AddMenuItem("Login","Page1") ' Adds menu item mnuPage1
Activity.AddMenuItem("Exercises","Page2") ' Adds menu item mnuPage2
Activity.AddMenuItem("Lessons","Page3") ' Adds menu item mnuPage3
Activity.AddMenuItem("Profile","profile")
' Activity.AddView(RadioButton1,0,0,-2,-2)
ScrollView1.AddView(RadioButton1,0,0,-2,-2)
RadioButton1.BringToFront
End Sub
Sub Page1_Click
pnlPage2.Visible = False ' Hides pnlPage2
pnlPage3.Visible = False ' Hides pnlPage3
pnlPage1.Visible = True ' Sets pnlPage1 to Visible
pnlProfile.Visible = False
End Sub
Sub Page2_Click
pnlPage1.Visible = False ' Hides pnlPage1
pnlPage3.Visible = False ' Hides pnlPage3
pnlPage2.Visible = True ' Sets pnlPage2 to Visible
pnlProfile.Visible = False
End Sub
Sub Page3_Click
pnlPage1.Visible = False ' Hides pnlPage1
pnlPage2.Visible = False ' Hides pnlPage2
pnlPage3.Visible = True ' Sets pnlPage3 to Visible
pnlProfile.Visible = False
End Sub
Sub profile_Click
pnlPage1.Visible = False ' Hides pnlPage1
pnlPage2.Visible = False ' Hides pnlPage2
pnlPage3.Visible = False ' Sets pnlPage3 to Visible
pnlProfile.Visible = True
End Sub
Sub btnEnterSchool_Click
Log(sp.Play(waterDrop, 1, 1, 1, 0, 1))
pnlPage1.Visible = False ' Hides pnlPage1
pnlPage2.Visible = True ' Shows pnlPage2
pnlPage3.Visible = False ' Sets pnlPage3 to Visible
pnlProfile.Visible = False
' checkUser
End Sub
Sub radioBtnAnswer_Click
Dim Send As Button
Send = Sender
Log(sp.Play(waterDrop, 1, 1, 1, 0, 1))
radioBtnAnswer1.Checked = False
radioBtnAnswer2.Checked = False
radioBtnAnswer3.Checked = False
radioBtnAnswer4.Checked = False
Select Send.Tag
Case "1"
radioBtnAnswer1.Checked = True
chosenAnsBtn = 1
Case "2"
radioBtnAnswer2.Checked = True
chosenAnsBtn = 2
Case "3"
radioBtnAnswer3.Checked = True
chosenAnsBtn = 3
Case "4"
radioBtnAnswer4.Checked = True
chosenAnsBtn = 4
End Select
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub