A wrap for this Github project. Posting
1. B4A sample project
2. B4A library files
3. Java code (I have been lazy - change it to your liking)
4. LibRes.zip - extract it and copy the folder into the B4A project so that it is on the same folder level as that of the /Files and /Objects folders of the B4A project.
Sample code:
Library:
AwesomeSpeedometer
Author: Github: Anas Altair, Wrapped by: Johan Schoeman
Version: 1
1. B4A sample project
2. B4A library files
3. Java code (I have been lazy - change it to your liking)
4. LibRes.zip - extract it and copy the folder into the B4A project so that it is on the same folder level as that of the /Files and /Objects folders of the B4A project.
Sample code:
B4X:
#Region Project Attributes
#ApplicationLabel: AwesomeSpeedometer
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#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 as1 As AwesomeSpeedometer
Dim maxSpeed As Int = 200
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)
as1.MaxSpeed = 200
as1.IndicatorColor = Colors.red
as1.TrianglesColor = Colors.Magenta
as1.MarkColor = Colors.Red
as1.TextColor = Colors.White
as1.SpeedometerColor = Colors.Cyan
as1.Unit = "mph"
as1.SpeedTextColor = Colors.Green
End Sub
Sub Activity_Resume
t.Enabled = True
End Sub
Sub Activity_Pause (UserClosed As Boolean)
t.Enabled = False
End Sub
Sub t_tick
as1.speedTo_2(Rnd(0,maxSpeed+1),500)
End Sub
Library:
AwesomeSpeedometer
Author: Github: Anas Altair, Wrapped by: Johan Schoeman
Version: 1
- AwesomeSpeedometer
Fields:- 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)
- speedPercentTo (percent As Int)
change speed to percent value.
percent percent value to change, should be between [0,100]. - speedTo_1 (speed As Int)
if speed is less than 0 then speed will be 0.
speed correct speed to move. - speedTo_2 (speed As Int, moveDuration As Long)
speed correct speed to move.
moveDuration The length of the animation, in milliseconds. This value cannot be negative.
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- IndicatorColor As Int [write only]
- Left As Int
- MarkColor As Int [write only]
- MaxSpeed As Int [write only]
- Parent As Object [read only]
- SpeedTextColor As Int [write only]
- SpeedTextSize As Float [write only]
- SpeedometerColor As Int [write only]
- SpeedometerWidth As Float [write only]
- Tag As Object
- TextColor As Int [write only]
- Top As Int
- TrianglesColor As Int [write only]
- Unit As String [write only]
- Visible As Boolean
- Width As Int