#Region Project Attributes
#ApplicationLabel: b4aDigitSpeedView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\LibRes
#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
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 dsv1 As DigitSpeedView
Private dsv2 As DigitSpeedView
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", 1000)
dsv1.SpeedTextColor = Colors.Yellow
dsv1.UnitTextColor = Colors.White
dsv1.SpeedViewBackgroundColor = Colors.ARGB(100, 0, 0, 96)
dsv1.SpeedUnit = "MPH"
dsv1.SpeedTextSize = 35
dsv1.UnitTextSize = 15
dsv1.DisplayBackgroundImage = False
dsv2.SpeedTextColor = Colors.Yellow
dsv2.UnitTextColor = Colors.Green
' dsv2.SpeedViewBackgroundColor = Colors.Black
dsv2.SpeedUnit = "km/h"
dsv2.SpeedTextSize = 60
dsv2.UnitTextSize = 15
dsv2.DisplayBackgroundImage = True
dsv2.SpeedShadowSize = 40
dsv2.UnitShadowSize = 40
dsv2.UnitShadowColor = Colors.Yellow
dsv2.SpeedShadowColor = Colors.Red
End Sub
Sub Activity_Resume
t.Enabled = True
End Sub
Sub Activity_Pause (UserClosed As Boolean)
t.Enabled = False
End Sub
Sub t_tick
dsv1.updateSpeed(Rnd(0,201))
dsv2.updateSpeed(Rnd(0,1000))
End Sub
Sub dsv1_speed_changed(speed As Int)
Log("B4A Speed 1 = " & speed)
End Sub
Sub dsv2_speed_changed(speed As Int)
Log("B4A Speed 2 = " & speed)
End Sub