It wraps this Github project. It is a countdown view. The countdown timer runs in the library. The maximum time (for countdown) that it can be set to is 3 600 000 (i.e 60 minutes). It raises an event in B4A (approximately every 1000ms) and also an event when the countdown has been completed.
Posting the following:
1. B4A project demonstrating the countdown view
2. B4A library files
3. The Java code
Sample code:
The library:
ContinuableCircleCountDownView
Author: Github: Serhat Surguvec, Wrapped by: Johan Schoeman
Version: 1
Posting the following:
1. B4A project demonstrating the countdown view
2. B4A library files
3. The Java code
Sample code:
B4X:
#Region Project Attributes
#ApplicationLabel: ContinuableCircleCountDownView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#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.
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 cccdv1 As ContinuableCircleCountDownView
Private cccdv2 As ContinuableCircleCountDownView
Private cccdv3 As ContinuableCircleCountDownView
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")
cccdv1.INNER_COLOR = Colors.Green
cccdv1.OUTER_COLOR = Colors.Blue
cccdv1.PROGRESS_COLOR = Colors.Yellow
cccdv1.TEXT_COLOR = Colors.Black
cccdv1.Timer_1 = 120000
cccdv1.startFrom(0, True)
cccdv1.RATE = 15
cccdv1.TextSize = 20
cccdv1.start
cccdv2.INNER_COLOR = Colors.Yellow
cccdv2.OUTER_COLOR = Colors.Green
cccdv2.PROGRESS_COLOR = Colors.Blue
cccdv2.TEXT_COLOR = Colors.Red
cccdv2.Timer_1 = 60000
cccdv2.startFrom(0, True)
cccdv2.RATE = 10
cccdv2.TextSize = 25
cccdv2.start
cccdv3.INNER_COLOR = Colors.Blue
cccdv3.OUTER_COLOR = Colors.Yellow
cccdv3.PROGRESS_COLOR = Colors.Green
cccdv3.TEXT_COLOR = Colors.White
cccdv3.Timer_1 = 180000
cccdv3.startFrom(0, True)
cccdv3.RATE = 6
cccdv3.TextSize = 15
cccdv3.start
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub cccdv1_tick(ticks As Long)
Log("cccdv1 " & ticks)
End Sub
Sub cccdv1_completed
Log("cccdv1 COMPLETED")
End Sub
Sub cccdv2_tick(ticks As Long)
Log("cccdv2 " & ticks)
End Sub
Sub cccdv2_completed
Log("cccdv2 COMPLETED")
End Sub
Sub cccdv3_tick(ticks As Long)
Log("cccdv3 " & ticks)
End Sub
Sub cccdv3_completed
Log("cccdv3 COMPLETED")
End Sub
The library:
ContinuableCircleCountDownView
Author: Github: Serhat Surguvec, Wrapped by: Johan Schoeman
Version: 1
- ContinuableCircleCountDownView
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)
- cancel
Cancels timer
Offset is not reset , u have to implement yourself. - continueE
Continues - isFinished As Boolean
- isStarted As Boolean
- isStopped As Boolean
- start
millis must be lower than 60000 millis and greater than 0
interval must be lower than millis and greater than 0 - startFrom (angle As Float, animate As Boolean)
Please provide an angle between 0-360 , time will be calculated automatically - stop
Stops the time makes it continue-able
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- INNER_COLOR As Int [write only]
- Left As Int
- OUTER_COLOR As Int [write only]
- PROGRESS_COLOR As Int [write only]
- RATE As Int [write only]
Set the size of the inner circle
A value from 6 to 15 - TEXT_COLOR As Int [write only]
- Tag As Object
- TextSize As Float [write only]
- Timer_1 As Long [write only]
millis must be lower than 3,600,000 millis and greater than 0 - Top As Int
- Visible As Boolean
- Width As Int