B4A Library ProgressWheel v0.22

ProgressWheel
Version:
0.2
  • pgWheel
    Events:
    • onClick (value As Object)
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • bringToFront
    • buildDrawingCache
    • buildDrawingCache2 (autoscale As Boolean)
    • clearAnimation
    • computeScroll
    • incrementProgress
      Increment the progress by 1 (of 360)
    • isSpinning As Boolean
    • spin
      Puts the view on spin mode
    • stopSpinning
      Turn off spin mode
    Properties:
    • BarColor As Int
    • BarLength As Int
    • BarWidth As Int
    • CircleColor As Int
    • CircleRadius As Int
    • Clickable As Boolean [write only]
    • ContourColor As Int
    • ContourSize As Float
    • DelayMillis As Int
    • Enabled As Boolean [write only]
    • FadingEdgeLength As Int [write only]
    • Focusable As Boolean [write only]
    • FocusableInTouchMode As Boolean [write only]
    • Id As Int [write only]
    • Left As Int
    • MinimumHeight As Int [write only]
    • MinimumWidth As Int [write only]
    • PaddingBottom As Int
    • PaddingLeft As Int
    • PaddingRight As Int
    • PaddingTop As Int
    • Progress As Int [write only]
      Set the progress to a specific value
    • RimColor As Int
    • RimShader As Shader [write only]
    • RimWidth As Int
    • SpinSpeed As Int
    • Tag As Object [write only]
    • Text As String [write only]
    • TextColor As Int
    • TextSize As Int
    • Top As Int

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim pg1, pg2 As pgWheel
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("main")
    pg1.Initialize("pgw")
    pg1.AddToParent(Activity,10dip,10dip,40dip,40dip)
    pg1.CircleRadius = 80
    pg1.RimWidth = 10
    pg1.SpinSpeed = 4
    pg1.spin

    pg2.Initialize("pgw")
    pg2.AddToParent(Activity,60dip,10dip,125dip,125dip)
    pg2.CircleRadius = 70
    pg2.RimWidth = 15
    pg2.SpinSpeed = 4
    pg2.BarColor = Colors.Red
    pg2.ContourSize = 1
    pg2.RimColor = Colors.Blue
    pg2.CircleColor = Colors.Green
    pg2.Text = "Hallo World"
    pg2.spin
End Sub

progresswheel0014.png


 

Attachments

  • ProgressWheelExample.zip
    7.7 KB · Views: 653
  • libProgressWheel.zip
    11.2 KB · Views: 513
  • libProgressWheel_v0.20.zip
    11.2 KB · Views: 488
  • libProgressWheel_v0.22.zip
    11.4 KB · Views: 636
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
Works on old android versions? what minimal?
 

Michael Höpner

Member
Licensed User
Longtime User
Hi DonManfred
my question: How can i make the wheel to diappear?
There is no "sendtoback" or how can i >distroy< the wheel?
When it will be able Please answer
 

DonManfred

Expert
Licensed User
Longtime User
my question: How can i make the wheel to diappear?
in v0.22 you can set the visibility.
Lib is uploaded to Post #1

example:
B4X:
Sub btnhide_Click
    'Log(pg2.Visible)
    If pg2.Visible Then
        pg2.Visible = False
    Else
        pg2.Visible = True
    End If
End Sub
 

bluedude

Well-Known Member
Licensed User
Longtime User
Pretty!

Could you make the inner circle like a clickable button that has a pressed effect? I want to use this as a round button that starts to spin when clicked and stops when the process is finished.

Cheers.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Clickable would be cool but it would need to have pressed states etc. I just solved it by adding a normal button with big rounded corners (half size of width and height).

Can you add height and width properties to the object so that I can resize my normal button precisely inside the progress wheel?

The end result is pretty good. Did not test transparancy yet on a photo background.

The middle white button is clickable and has borders etc. I will use the combined solution for scanning nearby objects (iBeacons etc.) When the button is clicked it will start spinning until all results are found.
 

Attachments

  • Screenshot_2015-03-05-13-23-55.png
    Screenshot_2015-03-05-13-23-55.png
    54.8 KB · Views: 401

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Hi,
I need it for Subs long jobs
I initialize like:

ww.Initialize("ww")
ww.AddToParent(Activity,50%y-25dip,50%x-25dip,50dip,50dip)
ww.CircleRadius = 80
ww.RimWidth = 10
ww.SpinSpeed = 4
ww.spin
ww.Visible=False

But when I want to use
ww.visible=true
in a sub I get a java error Null pointer exception

whats wrong?

Another problem is, when I am , by ex, refreshing a customlistview it stops spinnig and then it is of no use ata all.

Thanks
 

Taha

Member
Licensed User
Longtime User
What is computeScroll?
onClick (value As Object) - what value is generated?
 
Top