Hello. i'm looking to do something like this:
For this code i'm use a normal progressbar.
i have find this in the forum:
But the circleprogressbarr.value is a floar or a int, and i convert the datetime into string...
For this code i'm use a normal progressbar.
i have find this in the forum:
[B4X] [XUI] [custom view] CircularProgressBar
This class is compatible with B4A, B4i and B4J. A simple circular progress bar implemented as a custom view. Usage: Add the class to your project and add a custom view with the designer. Set its value with" CircularProgressBar1.Value = 100 The animation is smooth in release mode...
www.b4x.com
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim ClickTimer As Timer
End Sub
Sub Globals
Private Circle As CircleTimerView
Private Button1 As Button
Private TimerLabel As Label
Dim StrUt As StringFunctions
StrUt.Initialize
Dim StartTime As Long
Dim InizioTimer As Long
Dim FineTimer As Long
Dim TempoVisualizzato As Long
Dim timeclick As Int
Dim timetxt As String
Private last As Float
Private second As Float = 0.001745329238474369
Private energyProgressBar As ProgressBar
End Sub
Sub Button1_Click
If ClickTimer.IsInitialized = True Then
Log(ConvertTicksToHHMMSSMS(TempoVisualizzato))
End If
StartTime = DateTime.Now
ClickTimer.Enabled = True
TimerLabel.Text = ConvertTicksToHHMMSSMS(TempoVisualizzato)
Log(ConvertTicksToHHMMSSMS(TempoVisualizzato))
End Sub
Sub ConvertTicksToHHMMSSMS(Time As Long) As String
Dim Diff As Long = DateTime.Now - StartTime
TempoVisualizzato = InizioTimer - Diff
Dim HH,MM,SS,MS As Int
Dim T As Long=Abs(Time)
If TempoVisualizzato < FineTimer Then
ClickTimer.Enabled = False
Return "Claim BTC"
Else
MS = T Mod 1000
SS = (T/1000) Mod 60
MM = (T/60000) Mod 60
HH = (T/3600000) Mod 24
Return NumberFormat(MM,2,0) & ":" & NumberFormat(SS,2,0)
End If
End Sub
Sub ClickTimer_Tick
Dim sec As Float = 0.6
energyProgressBar.Progress = energyProgressBar.Progress -sec
Log(sec)
Log(energyProgressBar.Progress)
End Sub
Sub Circle_onTimerTick(radian As Float)
Dim sec As Int = Abs(radian/second)
Dim minutes As Int = Abs(sec/60)
Dim seconds As Int = Abs(sec-(minutes*60))
'Dim s As Int = Floor(radian/second/60)
Log("Timer: "&NumberFormat2(minutes,2,0,0,False)&":"&NumberFormat2(seconds,2,0,0,False))
'Log("Timer Tick: "&(radian-last))
last = radian
End Sub
Last edited: