It wraps this Github project. All of the "Loading" indicators have some nice animations. Posting the B4A project, the B4A library files (including android-support-annotations.jar), and the Java code. Copy the library files to your additional library folder.
Sample code:
Loading
Author: Johan Schoeman
Version: 1
Sample code:
B4X:
#Region Project Attributes
#ApplicationLabel: Loading
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#AdditionalJar: android-support-annotations
#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.
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 rl1, rl2 As RotateLoading
Private bl1 As BookLoading
Private b1 As Button
Private b2 As Button
Private bl2 As BookLoading
Private ncl1, ncl2 As NewtonCradleLoading
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")
rl1.CircleWidth = 5
rl1.ShadowColor = Colors.white
rl1.CircleColor = Colors.blue
rl1.ShadowPosition = 2
rl1.FadeInTime = 1000
rl1.FadeOutTime = 5000
rl2.CircleWidth = 7
rl2.ShadowColor = Colors.red
rl2.CircleColor = Colors.Yellow
rl2.ShadowPosition = 5
rl2.FadeInTime = 5000
rl2.FadeOutTime = 1000
bl1.Visible = False
bl1.NumberOfPages = 5
bl1.Duration = 300
bl2.Visible = False
bl2.NumberOfPages = 10
bl2.Duration = 2000
'colors are by default white - so only change colors of some balls to something other that white
ncl1.Visible = False
ncl1.Ball_1_Color = Colors.Red
ncl1.Ball_5_Color = Colors.Yellow
ncl1.Ball_3_Color = Colors.Blue
ncl2.Visible = False
ncl2.Ball_1_Color = Colors.Magenta
ncl2.Ball_5_Color = Colors.Cyan
ncl2.Ball_3_Color = Colors.Green
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub b1_Click
bl1.Visible = True
bl2.Visible = True
ncl1.Visible = True
ncl2.Visible = True
rl1.start
rl2.start
bl1.start
bl2.start
ncl1.start
ncl2.start
End Sub
Sub b2_Click
rl1.stop
rl2.stop
bl1.stop
bl2.stop
ncl1.stop
ncl2.stop
bl1.Visible = False
bl2.Visible = False
ncl1.Visible = False
ncl2.Visible = False
End Sub
Loading
Author: Johan Schoeman
Version: 1
- BookLoading
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)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- start
- stop
- Background As Drawable
- Color As Int [write only]
- Duration As Long [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- NumberOfPages As Int [write only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- NewtonCradleLoading
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)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- start
- stop
- Background As Drawable
- Ball_1_Color As Int [write only]
- Ball_2_Color As Int [write only]
- Ball_3_Color As Int [write only]
- Ball_4_Color As Int [write only]
- Ball_5_Color As Int [write only]
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- RotateLoading
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)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- start
- stop
- Background As Drawable
- CircleColor As Int [write only]
- CircleWidth As Int [write only]
- Color As Int [write only]
- Enabled As Boolean
- FadeInTime As Long [write only]
- FadeOutTime As Long [write only]
- Height As Int
- Left As Int
- ShadowColor As Int [write only]
- ShadowPosition As Int [write only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int