B4A Library IndeterminateProgressView

Johan Schoeman

Expert
Licensed User
The attached projects wraps this. The project depends on files in the Objects/res/values folder of the B4A project. Therefore use this B4A project as your base if you want to make use of it. The library files (JAR & XML) are in the /Files folder of the attached project. Copy them to your additional library folder.

The B4A project also makes use of CustomViews. You therefore need to set the CustomType of the CustomView to IndeterminateProgressView once you have selected/enabled library IndeterminateProgressView in your B4A project and added additional/new CustomView views.

Circles spin CW and then ACW. You can define as many colors as you want for each circle.

Enjoy!

(Thanks @DonManfred)

Edit: See project with new library files in post #2

IndeterminateProgressView.png
 

Attachments

Last edited:

Johan Schoeman

Expert
Licensed User
An update. New library files (JAR and XML) are in the /files folder of the B4A project. Copy them to / replace them in your additional libraries folder. Addition adds the following:
1. Set the spinning duration of each circle individually
2. Set ReverseAnimation to True or False:
If True then the spinning direction will reverse
If False then the spinning direction will continue in a CW direction (but the spinning circle will spin, come to a halt, and then continue in the CW direction, etc, etc)​
As mentioned in post #1 - the B4A project also makes use of CustomViews. You therefore need to set the CustomType of the CustomView to IndeterminateProgressView once you have selected/enabled library IndeterminateProgressView in your B4A project and added additional/new CustomView views.
By the way - the spinning circles in the attached project (and the project in post #1) simulates the Olympic symbol (blue, black, red, yellow, green). The spinning circle above it is a combination of all the colors used in the makeup of the Olympic symbol.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
 
    ipv1.Visible = True
    ipv2.Visible = True
    ipv3.Visible = True
    ipv4.Visible = True
    ipv5.Visible = True
    ipv6.Visible = True
 
    Dim a(4) As Int = Array As Int (Colors.Blue, Colors.Blue, Colors.Blue, Colors.White) 
    ipv1.ColorScheme = a
 
    Dim b(4) As Int = Array As Int (Colors.Black, Colors.Black, Colors.Black, Colors.White) 
    ipv2.ColorScheme = b
 
    Dim c(4) As Int = Array As Int (Colors.Red, Colors.Red, Colors.Red, Colors.White) 
    ipv3.ColorScheme = c 
 
    Dim d(4) As Int = Array As Int (Colors.Yellow, Colors.Yellow, Colors.Yellow, Colors.White) 
    ipv4.ColorScheme = d     
 
    Dim e(4) As Int = Array As Int (Colors.Green, Colors.Green, Colors.Green, Colors.White) 
    ipv5.ColorScheme = e 
 
    Dim f(6) As Int = Array As Int (Colors.Blue, Colors.Black, Colors.Red, Colors.Yellow, Colors.Green, Colors.White) 
    ipv6.ColorScheme = f
 
    ipv1.ReverseAnimation = True
    ipv2.ReverseAnimation = False
    ipv3.ReverseAnimation = True
    ipv4.ReverseAnimation = False
    ipv5.ReverseAnimation = True
    ipv6.ReverseAnimation = True
 
    ipv1.Duration = 2000
    ipv2.Duration = 4000
    ipv3.Duration = 6000
    ipv4.Duration = 8000
    ipv5.Duration = 10000
    ipv6.Duration = 12000
 
End Sub
IndeterminateProgressView
Version:
1

  • Methods:
    • dpToPixels (dp As Float, resources As Resources) As Int
      Convert Dp to Pixel
    • pixelsToDp (context As Context, dp As Int) As Int
  • IndeterminateProgressView
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • 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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • ColorScheme() As Int [write only]
    • Duration As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • ReverseAnimation As Boolean [write only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

Last edited:
Top