B4X:
#Region Project Attributes
#ApplicationLabel: SpiderXise test
#VersionCode: 1
#VersionName: 1.0.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: True
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim IsDebugMode As Boolean = True, TimerMain As Timer, AppTitle As String = "SpiderXise", RunType As Int
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Vscroll As ScrollView
Dim LeftButton As Button, RightButton As Button
Dim BGstats As Canvas
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
Dim temp As Int, temp2 As Int
Select Case KeyCode
Case 4: Return True'back
Case 82: 'menu
temp = InputList(Array As String("Marathon", "Timed", "Cycles"), "Select a mode", RunType)
If temp > -1 Then
Select Case temp
Case 1'time
temp2=AskTime("How long would you like to " & AppTitle & " for?", "Hours:Minutes", False,True, "OK", "Cancel", "")
Case 2'cycles
temp2=AskNumbers("How many cycles?", 4, 0, False, 0, "OK", "Cancel", "")
End Select
Msgbox(temp2, AppTitle)
If temp2>-1 Then RunType = temp
End If
Case Else
Msgbox("ERROR", KeyCode)
End Select
End Sub
'InputType: 0=none, 1=DECIMAL NUMBERS, 2=NUMBERS, 3=Phone, 4=text
Sub AskDialog(InputType As Int, Title As String, Message As String, Positive As String, Cancel As String, Negative As String) As Int
Dim Dialog As InputDialog
Select Case InputType
Case 0: Dialog.InputType = Dialog.INPUT_TYPE_NONE
Case 1: Dialog.InputType = Dialog.INPUT_TYPE_DECIMAL_NUMBERS
Case 2: Dialog.InputType = Dialog.INPUT_TYPE_NUMBERS
Case 3: Dialog.InputType = Dialog.INPUT_TYPE_PHONE
Case 4: Dialog.InputType = Dialog.INPUT_TYPE_TEXT
End Select
Return Dialog.Show(Message, Title, Positive, Cancel, Negative, Null)
End Sub
Sub AskTime(Title As String, Message As String, UseNow As Boolean, Is24Hours As Boolean, Positive As String, Cancel As String, Negative As String) As Int
Dim td As TimeDialog
If UseNow Then
td.Hour = DateTime.GetHour(DateTime.Now)
td.Minute = DateTime.GetMinute(DateTime.Now)
End If
td.Is24Hours = Is24Hours
Return td.Show(Message, Title, Positive, Negative, Cancel, Null)
End Sub
Sub AskNumbers(Title As String, Digits As Int, Default As Int, AllowNegatives As Boolean, DecimalPlaces As Int, Positive As String, Cancel As String, Negative As String) As Int
Dim nd As NumberDialog, ret As String
nd.Digits = Digits
If Not(AllowNegatives) AND Default < 0 Then Default = Abs(Default)
nd.Number = Default
nd.Decimal = DecimalPlaces
nd.ShowSign = AllowNegatives
Return nd.Show(Title, Positive, Negative, Cancel, Null)
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim Y As Int
TimerMain.Initialize("MainTimer", DateTime.TicksPerSecond)
Vscroll.Initialize(Activity.Height)
Activity.AddView(Vscroll, 0,0, Activity.Width, Activity.Height)
If IsDebugMode Then
Y=Activity.Width * 0.5
LeftButton.Initialize("Left")
LeftButton.Text = "Left"
Vscroll.Panel.AddView(LeftButton, 0,0, Y, Y)
RightButton.Initialize("Right")
RightButton.Text = "Right"
Vscroll.Panel.AddView(RightButton, Y,0, Y, Y)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub No_Click
ToastMessageShow("You must click the other side first", False)
End Sub
Sub MainTimer_Tick
End Sub
Add the dialogs library
Set the SDK version/target to 4, click menu and follow through. I have no idea why