#Region Project Attributes
#ApplicationLabel: b4aTabDigit
#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 t As Timer
Dim nativeMe As JavaObject
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 tdsec1 As TabDigitNew
Private tdsec10 As TabDigitNew
Private tdmin1 As TabDigitNew
Private tdmin10 As TabDigitNew
Private tdhr1 As TabDigitNew
Private tdhr10 As TabDigitNew
Dim prevsec1 As Int
Dim prevsec10 As Int
Dim prevmin1 As Int
Dim prevmin10 As Int
Dim prevhr1 As Int
Dim prevhr10 As Int
Dim aw As Int
Dim ah As Int
Dim sec1direction, sec10direction, min1direction, min10direction, hr1direction, hr10direction As Boolean = False
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")
nativeMe.InitializeContext
t.Initialize("t", 10)
tdsec1.Chars = Array As Char("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
tdsec10.Chars = Array As Char("0", "1", "2", "3", "4", "5")
tdmin1.Chars = Array As Char("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
tdmin10.Chars = Array As Char("0", "1", "2", "3", "4", "5")
tdhr1.Chars = Array As Char("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
tdhr10.Chars = Array As Char("0", "1", "2")
Dim hour As Int = DateTime.GetHour(DateTime.Now)
Dim minute As Int = DateTime.GetMinute(DateTime.Now)
Dim second As Int = DateTime.GetSecond(DateTime.Now)
tdsec1.Char = second Mod 10
tdsec10.Char = second - (second Mod 10)
tdsec1.TextSize = 100
tdsec1.DividerColor = Colors.Red
tdsec1.Padding = 30
tdsec1.TextColor = Colors.Cyan
tdsec1.BackgroundColor = Colors.Gray
prevsec1 = second Mod 10
tdsec10.Char = (second - (second Mod 10))/10
tdsec10.TextSize = 100
tdsec10.DividerColor = Colors.Red
tdsec10.Padding = 30
tdsec10.TextColor = Colors.Cyan
tdsec10.BackgroundColor = Colors.Gray
prevsec10 = (second - (second Mod 10))/10
tdmin1.Char = minute Mod 10
tdmin10.Char = minute - (minute Mod 10)
tdmin1.TextSize = 100
tdmin1.DividerColor = Colors.Red
tdmin1.Padding = 30
tdmin1.TextColor = Colors.Blue
tdmin1.BackgroundColor = Colors.white
prevmin1 = minute Mod 10
tdmin10.Char = (minute - (minute Mod 10))/10
tdmin10.TextSize = 100
tdmin10.DividerColor = Colors.Red
tdmin10.Padding = 30
tdmin10.TextColor = Colors.Blue
tdmin10.BackgroundColor = Colors.white
prevmin10 = (minute - (minute Mod 10))/10
tdhr1.Char = hour Mod 10
tdhr10.Char = hour - (hour Mod 10)
tdhr1.TextSize = 100
tdhr1.DividerColor = Colors.Red
tdhr1.Padding = 30
tdhr1.TextColor = Colors.Yellow
tdhr1.BackgroundColor = Colors.LightGray
prevhr1 = hour Mod 10
tdhr10.Char = (hour - (hour Mod 10))/10
tdhr10.TextSize = 100
tdhr10.DividerColor = Colors.Red
tdhr10.Padding = 30
tdhr10.TextColor = Colors.Yellow
tdhr10.BackgroundColor = Colors.LightGray
prevhr10 = (hour - (hour Mod 10))/10
End Sub
Sub Activity_Resume
t.Enabled = True
End Sub
Sub Activity_Pause (UserClosed As Boolean)
t.Enabled = False
End Sub
Sub t_tick
Dim hour As Int = DateTime.GetHour(DateTime.Now)
Dim minute As Int = DateTime.GetMinute(DateTime.Now)
Dim second As Int = DateTime.GetSecond(DateTime.Now)
If prevsec1 <> second Mod 10 Then
sec1direction = Not(sec1direction)
tdsec1.ChangeDirection = sec1direction
tdsec1.start
prevsec1 = second Mod 10
End If
If prevsec10 <> (second - (second Mod 10))/10 Then
sec10direction = Not(sec10direction)
tdsec10.ChangeDirection = sec10direction
tdsec10.start
prevsec10 = (second - (second Mod 10))/10
End If
If prevmin1 <> minute Mod 10 Then
min1direction = Not(min1direction)
tdmin1.ChangeDirection = min1direction
tdmin1.start
prevmin1 = minute Mod 10
End If
If prevmin10 <> (minute - (minute Mod 10))/10 Then
min10direction = Not(min10direction)
tdmin10.ChangeDirection = min10direction
tdmin10.start
prevmin10 = (minute - (minute Mod 10))/10
End If
If prevhr1 <> hour Mod 10 Then
hr1direction = Not(hr1direction)
tdhr1.ChangeDirection = hr1direction
tdhr1.start
prevhr1 = hour Mod 10
End If
If prevhr10 <> (hour - (hour Mod 10))/10 Then
hr10direction = Not(hr10direction)
tdhr10.ChangeDirection = hr10direction
tdhr10.start
prevhr10 = (hour - (hour Mod 10))/10
End If
End Sub