B4A Library ContinuableCircleCountDownView

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

1.png


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
    Methods:
    • 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
    Properties:
    • 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
 

Attachments

  • TheJavaCode.zip
    9.1 KB · Views: 330
  • b4aContinuableCircleCountDownView.zip
    8.4 KB · Views: 378
  • ContinuableCircleCountDownView.zip
    14.7 KB · Views: 381

rkxo

Active Member
Licensed User
Longtime User
hi, i get this error with ContinuableCircleCountDownView.I've B4A 6.30.
Erel coments that the package name shouldn't start with main, and ask to library developer to change the package name so it will not start with main.
it's possible?

Dim pnl As Panel = clv3.GetPanel(Sender)
Dim pnl1 As Panel = pnl.GetView(18)
Dim circle As ContinuableCircleCountDownView=pnl1.GetView(2)
circle.visible=false


Compiling generated Java code. Error
B4A line: 3323
circle = pnl1.GetView(2)
javac 1.8.0_77
src\xxx\xxx\com\main.java:6896: error: cannot find symbol
_circle.setObject((main.java.com.serhatsurguvec.continuablecirclecountdownview.ContinuableCircleCountDownView)(_pnl1.GetView((int) (2)).getObject()));
^
symbol: class java
location: class main



Thanks
 

Johan Schoeman

Expert
Licensed User
Longtime User
hi, i get this error with ContinuableCircleCountDownView.I've B4A 6.30.
Erel coments that the package name shouldn't start with main, and ask to library developer to change the package name so it will not start with main.
it's possible?

Dim pnl As Panel = clv3.GetPanel(Sender)
Dim pnl1 As Panel = pnl.GetView(18)
Dim circle As ContinuableCircleCountDownView=pnl1.GetView(2)
circle.visible=false


Compiling generated Java code. Error
B4A line: 3323
circle = pnl1.GetView(2)
javac 1.8.0_77
src\xxx\xxx\com\main.java:6896: error: cannot find symbol
_circle.setObject((main.java.com.serhatsurguvec.continuablecirclecountdownview.ContinuableCircleCountDownView)(_pnl1.GetView((int) (2)).getObject()));
^
symbol: class java
location: class main



Thanks
Changed the package names - try it and see if it sorts out your problem
 

Attachments

  • CCDV_LibFiles_V1_02.zip
    14.6 KB · Views: 286

kreativa

Member
Licensed User
Longtime User
Hi johan,
I'm using your library and i think it's great!!
I just have a little problem.
The timer sometimes loses a second during the countdown. How i can solve?

Thanks!
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi johan,
I'm using your library and i think it's great!!
I just have a little problem.
The timer sometimes loses a second during the countdown. How i can solve?

Thanks!
See if the attached lib files work better - have made the update interval 4x shorter (else it skips the update of the seconds every now and then)
 

Attachments

  • ContinuableCircleCountDownView.xml
    12.1 KB · Views: 271
  • ContinuableCircleCountDownView.jar
    14.9 KB · Views: 252

kreativa

Member
Licensed User
Longtime User
Hi johan,
how are you?
I need to ask you a question?
Can I use your library in B4J?
Thanks!
See if the attached lib files work better - have made the update interval 4x shorter (else it skips the update of the seconds every now and then)
 

DonManfred

Expert
Licensed User
Longtime User
Ok!
but how i can modify the property runtime? (like fullcolor ecc)
1. You should NOT post this question in this thread; instead you should always ceate a new thread in the questionsforum for each question you have.

2. The Class is included! Check the class and edit if if needed. :)
 
Last edited:
Top