ciao a tutti.
qualcuno ha mai provato ad ottenere questo risultato??
Cercando nel forum, ho trovato questo, che potrebbe essere utile:
ho modificato la classse in modo che venisse visualizzato il timer
and now it display as "05:00"
i hav edefine myMaxMillisecs as int on class
Now i need to add a timer, so:
Non riesco a capire come sincronizzare la barra ed il timer...
qualcuno ha mai provato ad ottenere questo risultato??
Cercando nel forum, ho trovato questo, che potrebbe essere utile:
[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
ho modificato la classse in modo che venisse visualizzato il timer
B4X:
Private Sub DrawValue(Value As Float)
cvs.ClearRect(cvs.TargetRect)
cvs.DrawCircle(cx, cy, radius, clrEmpty, False, stroke)
If myMaxMillisecs = 0 Then
mLbl.Text = "Claim BTC"
Else ' Show m:ss by scaling maxMilliseconds
Dim lblMillisecs As Long = myMaxMillisecs * (Value / 100) ' Adjust code here to round up or down to next second
mLbl.Text = ConvertTicksToTimeString(lblMillisecs)
End If
Dim startAngle = -90, sweepAngle = Value / 100 * 360 As Float
If Value < 100 Then
Dim p As B4XPath
p.InitializeArc(cx, cy, radius + stroke + 1dip, startAngle, sweepAngle)
cvs.ClipPath(p)
cvs.DrawCircle(cx, cy, radius - 0.5dip, clrFull, False, stroke + 1dip)
cvs.RemoveClip
Else
cvs.DrawCircle(cx, cy, radius - 0.5dip, clrFull, False, stroke + 1dip)
End If
cvs.Invalidate
End Sub
Sub ConvertTicksToTimeString(t As Long) As String
Dim hours, minutes, seconds As Int
hours = t / DateTime.TicksPerHour
minutes = (t Mod DateTime.TicksPerHour) / DateTime.TicksPerMinute
seconds = (t Mod DateTime.TicksPerMinute) / DateTime.TicksPerSecond
Return NumberFormat(minutes, 2, 0) & ":" & NumberFormat(seconds, 2, 0)
End Sub
and now it display as "05:00"
i hav edefine myMaxMillisecs as int on class
Now i need to add a timer, so:
B4X:
(in Process_Globals)
Dim clickTimer as timer
'--------------------------------------------------------'--------------------------------------------------------'--------------------------------------------------------
(Sub Activity_Create)
clickTimer.initialize("clickTimer",5000)
'--------------------------------------------------------'--------------------------------------------------------'--------------------------------------------------------
Sub Button1_Click
timer.Enabled = True
End Sub
'--------------------------------------------------------'--------------------------------------------------------'--------------------------------------------------------
Sub clickTimet_Tick
mLbl.Text = a ogni tick il timer dovrebbe diminuire ( 05:00-> 04:59-> 04:58-> 04:57...........00:01-> "Hello world" quando il valore della barra è diventa 100... :oops:??
(defined in clas as public)
End Sub
'--------------------------------------------------------'--------------------------------------------------------'--------------------------------------------------------
Non riesco a capire come sincronizzare la barra ed il timer...