A wrap for this Github project.
Extract LibRes.zip and then copy the folder with its contents to be on the same folder level as that of the B4A project's /Objects and /Files folders.
Sample Code:
Library:
DigitSpeedView
Author: Github: Riccardo Capuani, Wrapped by: Johan Schoeman
Version: 1
Extract LibRes.zip and then copy the folder with its contents to be on the same folder level as that of the B4A project's /Objects and /Files folders.
Sample Code:
B4X:
#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
Library:
DigitSpeedView
Author: Github: Riccardo Capuani, Wrapped by: Johan Schoeman
Version: 1
- DigitSpeedView
Events:- speed_changed (speed As Int)
- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- hideUnit
Hide unit text - showUnit
Show unit text - updateSpeed (speed As Int)
update speed
speed: to update
- Background As Drawable
- Color As Int [write only]
- DisplayBackgroundImage As Boolean [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Parent As Object [read only]
- SpeedShadowColor As Int [write only]
- SpeedShadowSize As Int [write only]
- SpeedTextColor As Int [write only]
- SpeedTextSize As Float [write only]
- SpeedUnit As String [write only]
- SpeedViewBackgroundColor As Int [write only]
- Tag As Object
- Top As Int
- UnitShadowColor As Int [write only]
- UnitShadowSize As Int [write only]
- UnitTextColor As Int [write only]
- UnitTextSize As Float [write only]
- Visible As Boolean
- Width As Int