The attached project wraps this Github project. You need to have android-support-v4.jar in your additional library folder. You can download it from here. Posting the following:
1. The B4A project demonstrating the use of this library
2. The java code. You need to copy android-support-v4.jar to the libs folder should you want to compile the java code. The libs folder is on the same folder level as the src folder.
3. the B4A library files (jar and xml)
Click on the button to get it going...
Some example code:
ProgressRndBtn
Author: Johan Schoeman
Version: 1
1. The B4A project demonstrating the use of this library
2. The java code. You need to copy android-support-v4.jar to the libs folder should you want to compile the java code. The libs folder is on the same folder level as the src folder.
3. the B4A library files (jar and xml)
Click on the button to get it going...
Some example code:
B4X:
#Region Project Attributes
#ApplicationLabel: ProgressRoundButton
#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, t1 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 prb1 As ProgressRoundButton
Private 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", 100)
t1.Initialize("t1", 1000)
prb1.BackgroundColor = Colors.Blue
prb1.BackgroundSecondColor = Colors.Green
prb1.ButtonRadius = 15.0
prb1.TheTextSize = 25.0
prb1.CurrentText = "START LOADING DATA"
prb1.MinProgress = 0
prb1.MinProgress = 100
prb1.Progress = 0
prb1.TextColor = Colors.Red
prb1.TextCoverColor = Colors.LightGray
prb1.State = 0
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub t_tick
cnt = cnt + 1
If cnt < 101 Then
prb1.Progress = cnt
Else
cnt = 0
t.Enabled = False
prb1.CurrentText = "PROCESSING DATA"
prb1.State = 2
t1.Enabled = True
End If
End Sub
Sub t1_tick
cnt = cnt + 1
If cnt = 5 Then
t1.Enabled = False
cnt = 0
prb1.CurrentText = "START LOADING DATA"
prb1.State = 0
End If
End Sub
Sub prb1_button_clicked
Log("Button prb1 clicked")
prb1.State = 1
prb1.CurrentText = "BUSY LOADING DATA"
t.Enabled = True
End Sub
ProgressRndBtn
Author: Johan Schoeman
Version: 1
- ProgressRoundButton
Fields:- ba As BA
- 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)
- SetTextColorAnimated (arg0 As Int, arg1 As Int)
- SetTextSizeAnimated (arg0 As Int, arg1 As Float)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- setProgressText (text As String, progress As Float)
- Background As Drawable
- BackgroundColor As Int [write only]
- BackgroundSecondColor As Int [write only]
- ButtonRadius As Float
- Color As Int [write only]
- CurrentText As CharSequence [write only]
- Enabled As Boolean
- Gravity As Int
- Height As Int
- Left As Int
- MaxProgress As Int
- MinProgress As Int
- Progress As Float
- State As Int
- Tag As Object
- Text As String
- TextColor As Int
- TextCoverColor As Int
- TextSize As Float
- TheTextSize As Float [write only]
- Top As Int
- Typeface As Typeface
- Visible As Boolean
- Width As Int
Attachments
Last edited: