B4A Library ArcProgressStackView

A wrapper for this Github project. Note the following:
1. There are 8 different animation interpolators to choose from
2. You can set as many indicators as you want
3. If you set for eg apsv1.IsDragged = True then you can drag each of the indicators forward/backwards with your finger. It will raise an event in B4A as the values are changing (by dragging) with the index and value of the indicator being dragged.

0.png


1.png


Posting:
1.B4A project for demo purposes
2. B4A library files - copy them to your additional library folder

Sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: ArcProgressStackView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private t As Timer

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private apsv1 As ArcProgressStackView
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")

    t.Initialize("t", 5000)

    apsv1.AnimationDuration = 3000
    apsv1.IsRounded = True                                             'give the indicators a rounded or a square finish
    apsv1.TextColor = Colors.White
    apsv1.IsDragged = True                                             'you can drag the individual indicators with your finger to increase/decrease the progress
    apsv1.ShadowDistance = 0
    apsv1.ShadowColor = Colors.White
    apsv1.DrawWidthFraction = 0.65
    apsv1.IsAnimated = True
    apsv1.IsShadowed = True
    apsv1.ModelBgEnabled = True
    apsv1.ProgressModelOffset = 0
    apsv1.ShadowAngle = 0
    apsv1.ShadowRadius = 0
    apsv1.ShadowDistance = 0
    apsv1.StartAngle = 0                                                '3 o'clock position
    apsv1.SweepAngle = 360                                              'eg 180 will only draw 1/2 a circle for the full range
    apsv1.Interpolator = apsv1.ANTICIPATEOVERSHOOTINTERPOLATOR          'this is one of 8 possible interpolators to select from
    apsv1.IndicatorOrientation = apsv1.INDICATORORIENTATIONHORIZONTAL   'it changes the progress text orientation

    apsv1.NumberOfIndicators = 3                                        'the following 4 arrays need to contain the same number of elements as apsv1.NumberOfIndicators = ......
    apsv1.IndicatorText = Array As String("A", "B", "C")
    apsv1.IndicatorColors = Array As Int(Colors.Blue, Colors.Magenta, Colors.Red)
    apsv1.IndicatorBgColors = Array As Int(Colors.DarkGray, Colors.Gray, Colors.LightGray)
    apsv1.IndicatorProgress = Array As Float(15.0, 30.0, 60.0)

    apsv1.drawArc

End Sub

Sub Activity_Resume

    t.Enabled = True

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub apsv1_progress_changed (index As Int, value As Float)
    Log("index = " & index & "     value = " & value)
End Sub

Sub t_tick

    apsv1.IndicatorProgress = Array As Float(Rnd(0, 101), Rnd(0,101), Rnd(0,101))
    apsv1.drawArc

End Sub

Library:

ArcProgressStackView
Author:
Github: GIGAMOLE, Wrapped by: Johan Schoeman
Version: 1
  • ArcProgressStackView
    Events:
    • progress_changed (index As Int, value As Float)
    Fields:
    • ACCELERATEDECELERATEINTERPOLATOR As String
    • ACCELERATEINTERPOLATOR As String
    • ANTICIPATEINTERPOLATOR As String
    • ANTICIPATEOVERSHOOTINTERPOLATOR As String
    • BOUNCEINTERPOLATOR As String
    • DECELERATEINTERPOLATOR As String
    • INDICATORORIENTATIONHORIZONTAL As String
    • INDICATORORIENTATIONVERTICAL As String
    • LINEARINTERPOLATOR As String
    • OVERSHOOTINTERPOLATOR As String
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • 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)
    • drawArc
    Properties:
    • AnimationDuration As Long [write only]
    • Background As Drawable
    • Color As Int [write only]
    • DrawWidthFraction As Float [write only]
    • Enabled As Boolean
    • Height As Int
    • IndicatorBgColors() As Int [write only]
    • IndicatorColors() As Int [write only]
    • IndicatorOrientation As String [write only]
    • IndicatorProgress() As Float [write only]
    • IndicatorText() As String [write only]
    • Interpolator As String [write only]
    • IsAnimated As Boolean [write only]
    • IsDragged As Boolean [write only]
    • IsRounded As Boolean [write only]
    • IsShadowed As Boolean [write only]
    • Left As Int
    • ModelBgEnabled As Boolean [write only]
    • NumberOfIndicators As Int [write only]
    • Parent As Object [read only]
    • ProgressModelOffset As Float [write only]
    • ShadowAngle As Float [write only]
    • ShadowColor As Int [write only]
    • ShadowDistance As Float [write only]
    • ShadowRadius As Float [write only]
    • StartAngle As Float [write only]
    • SweepAngle As Float [write only]
    • Tag As Object
    • TextColor As Int [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • ArcProgressStackViewLibFiles.zip
    36.8 KB · Views: 410
  • b4aArcProgressStackView.zip
    10.4 KB · Views: 394
Last edited:
Top