#Region Project Attributes
#ApplicationLabel: b4aCircleTimeView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#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 nativeMe As JavaObject
Dim t As Timer
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.
Private ctv1 As CircleTimeView
Private btnStart As Button
Private btnStop As Button
Private btnReset As Button
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("main")
t.Initialize("t", 5000)
nativeMe.InitializeContext
set_defaults
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnStart_Click
If ctv1.CurrentTimeInSeconds <> 0 Then
t.Enabled = True
ctv1.showLapsLabel 'use this or the next line.....
ctv1.LabelText = ""
ctv1.startTimer
End If
End Sub
Sub btnStop_Click
t.Enabled = False
ctv1.stopTimer
set_defaults
End Sub
Sub btnReset_Click
t.Enabled = False
ctv1.resetTime
set_defaults
End Sub
Sub ctv1_time_updated(tm As Long)
Log("timeupdated = " & tm)
End Sub
Sub ctv1_time_value_changed(tm As Long)
Log("timevaluechanged = " & tm)
End Sub
Sub ctv1_timer_started()
Log("timer started")
End Sub
Sub ctv1_timer_stopped()
t.Enabled = False
nativeMe.RunMethod("playTone", Null)
Log("calling set_defaults")
ctv1.hideLapsLabel
set_defaults
End Sub
Sub ctv1_time_manually_set(tm As Long)
Log("time_manually_set = " & tm)
End Sub
Sub ctv1_time_manually_changed(tm As Long)
Log("time_manually_changed = " & tm)
End Sub
Sub t_tick
ctv1.CircleButtonRadius = Rnd(10, 21)
ctv1.LapBackgroundColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.CircleButtonColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.QuarterNumberColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.TimeNumberColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.QuarterNumbersTextSize = Rnd(20, 40)
ctv1.TimeNumbersTextSize = Rnd(30, 50)
ctv1.MarkLineColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.MarkSize = Rnd(1,21)
ctv1.HighlightMarkLineColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.CircleButtonPressedColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.CircleColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.LapLabelTextColor = Colors.ARGB(255, Rnd(100, 255), Rnd(100, 255), Rnd(100, 255))
ctv1.QuarterMarkSize = Rnd(0, 26)
ctv1.CircleStrokeWidth = Rnd(1, 11)
ctv1.LapLabelMarginTop = Rnd(1,16)
ctv1.MarkLineWidth = Rnd(1,6)
ctv1.PaddingQuarterNumber = Rnd(5,21)
End Sub
Sub set_defaults
ctv1.CurrentTimeMode = ctv1.MODE_MANUAL_SETUP
ctv1.CircleButtonRadius = 20
ctv1.LapBackgroundColor = Colors.LightGray
ctv1.CircleButtonColor = Colors.Magenta
ctv1.QuarterNumberColor = Colors.Green
ctv1.TimeNumberColor = Colors.Cyan
ctv1.QuarterNumbersTextSize = 30
ctv1.TimeNumbersTextSize = 50
ctv1.MarkLineColor = Colors.Yellow
ctv1.MarkSize = 10
ctv1.HighlightMarkLineColor = Colors.White
ctv1.CircleButtonPressedColor = Colors.Red
ctv1.CircleColor = Colors.Cyan
ctv1.LapLabelTextColor = Colors.White
ctv1.QuarterMarkSize = 25
ctv1.CircleStrokeWidth = 1
ctv1.LapLabelMarginTop = 10
ctv1.MarkLineWidth = 1
ctv1.PaddingQuarterNumber = 1
ctv1.LabelText = "Set Time - Press Start"
ctv1.LabelTextColor = Colors.White
ctv1.LabelTextSize = 20
End Sub
#if Java
import android.media.ToneGenerator;
import android.media.AudioManager;
ToneGenerator tg;
public void playTone() {
tg = new ToneGenerator(AudioManager.RINGER_MODE_NORMAL, 100);
tg.startTone(ToneGenerator.TONE_CDMA_CONFIRM);
}
#end If