B4A Library PercentProgressBar

It wraps this Github project. Nothing spectacular but maybe someone will find a use for it.

Posting:
1. B4A project
2. B4A library files
3. Java code
4. Zip file containing 2 x *.ttf files. Copy them to the /Files folder of the B4A project

1.png



Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aPercentProgressBar
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #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.
    Dim 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 ppb1 As PercentCircularProgress
    Dim cnt As Int = 0
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", 500)
 
    ppb1.BackgroundColor = Colors.Red
    ppb1.TextColor = Colors.Green
    ppb1.TextSize = 35
    ppb1.ProgressColor = Colors.Blue
    ppb1.BackgroundStrokeWidth = 12
    ppb1.ProgressStrokeWidth = 6
    ppb1.RoundEdge = True
    ppb1.Typeface = "Roboto-Regular.ttf"
    ppb1.Progress = cnt
 
End Sub

Sub Activity_Resume
 
    t.Enabled = True

End Sub

Sub Activity_Pause (UserClosed As Boolean)
 
    t.Enabled = False

End Sub

Sub t_tick()
 
    cnt = cnt + 1
    ppb1.Progress = cnt 
 
End Sub

Sub ppb1_progress_completed
 
    t.Enabled = False
    Log("FINISHED")
 
End Sub

Sub ppb1_progress_changed(progress As Int)
 
    Log("progress = " & progress)
 
End Sub

PercentProgressLib
Author:
Github: natasam, Wrapped by: Johan Schoeman
Version: 1
  • PercentCircularProgress
    Events:
    • progress_changed (progress as Int As )
    • progress_completed
    Fields:
    • 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)
    • resetProgress
    Properties:
    • Background As Drawable
    • BackgroundColor As Int
    • BackgroundStrokeWidth As Int [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Progress As Float
    • ProgressColor As Int
    • ProgressStrokeWidth As Int [write only]
    • RoundEdge As Boolean [write only]
    • Shadow As Boolean [write only]
    • Tag As Object
    • TextColor As Int
    • TextSize As Int [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • b4aPercentProgressBar.zip
    8.8 KB · Views: 208
  • PercentProgressLibFiles.zip
    12.7 KB · Views: 222
  • TheJavaCode.zip
    160.2 KB · Views: 192
  • Roboto-Regular.zip
    148.6 KB · Views: 203
Last edited:
Top