B4A Library [B4X] [XUI] AnotherProgressBar

Status
Not open for further replies.

Erel

Administrator
Staff member
Licensed User
Edit: Latest version of AnotherProgressBar with several important improvements is available in XUI Views: https://www.b4x.com/android/forum/threads/100836/#content



A simple, cross platform, indeterminate progress bar.

Depends on BitmapCreator v4.50+: https://www.b4x.com/android/forum/threads/b4x-xui2d-box2d-game-engine.95208/

It uses the new BitmapCreator async drawing features.

The relevant code is:
B4X:
Private Sub BusyLoop
   Dim MyIndex As Int = BusyIndex
   Do While MyIndex = BusyIndex
       If Vertical Then
           BusyBrush.SrcOffsetY = BusyBrush.SrcOffsetY + 3
       Else
           BusyBrush.SrcOffsetX = BusyBrush.SrcOffsetX - 3
       End If
       Dim tasks As List
       tasks.Initialize
       tasks.Add(bc.AsyncDrawRect(bc.TargetRect, TransparentBrush, True, 0))
       tasks.Add(bc.AsyncDrawRectRounded(bc.TargetRect, BusyBrush, True, 0, 15))
       bc.DrawBitmapCreatorsAsync(Me, "BC", tasks)
       Wait For BC_BitmapReady (bmp As B4XBitmap)
       If xui.IsB4J Then bmp = bc.Bitmap
       bc.SetBitmapToImageView(bmp, mIV)
       Sleep(16)
   Loop
End Sub
A B4A project is attached. The custom view class is inside.

Updates:

v1.01 - Fixes an issue with the label visibility.
 
Last edited:

asales

Well-Known Member
Licensed User
If I start the AnotherProgressBar with visible = False in the designer, the text is not show, when the progress become visible.

If I use "AnotherProgressBar1.Visible = False" in the code, after load the layout, works.

Why this behavior?
 
Status
Not open for further replies.
Top