Android Question A problem with circular progress bar library

toby

Well-Known Member
Licensed User
Longtime User
My test app is based on the circular progress bar example

What I want to achieve: repeated counting down. When the value reaches 0, reset it to 100 and repeat.

Problems I'm having:
After the value reaches 0, value of 1 and 2 will appear briefly before 100 shows. These values of 1 and 2 should not be shown

Did I missing anything? How to fix the problem?

TIA
problem-ezgif.com-video-to-gif-converter.gif
 

Attachments

  • circularProgressbar-example to upload.zip
    10.2 KB · Views: 53

toby

Well-Known Member
Licensed User
Longtime User
related code:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    tmr1second.Initialize("tmr1second", 1000)
    'get starting point
    CircularProgressBar1.Value=CalculateSecondsLeft
    tmr1second.Enabled=True

End Sub


Private Sub tmr1second_Tick
    'count down:
    CircularProgressBar1.Value =CircularProgressBar1.Value-1 'Rnd(0, 101)
    If CircularProgressBar1.Value=0 Then CircularProgressBar1.Value =100
End Sub
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
Updated code that works, at least for my need.
circularProgressBar class:
'old one'
Public Sub setValue(NewValue As Float)
    AnimateValueTo(NewValue)
End Sub

'updated one'
Public Sub setValue(NewValue As Float)
    If NewValue=0 Or NewValue=100 Then
      'no animation
        currentValue = NewValue
        DrawValue(currentValue)
    Else         
        AnimateValueTo(NewValue)
    End If
End Sub
 
Upvote 0
Top