The attached project wraps this Github project. Posting the following:
1. B4A project demonstrating FAImageView
2. The B4A library files
3. The Java Code
4. frame02.zip, frame05.zip, frame08.zip, and frame10.zip. Extract the files and copy them to the /Objects/res/drawable folder of the B4A project (make sure they are set to READ ONLY)
Some sample code:
The library:
FAImageView
Author: Johan Schoeman
Version: 1
1. B4A project demonstrating FAImageView
2. The B4A library files
3. The Java Code
4. frame02.zip, frame05.zip, frame08.zip, and frame10.zip. Extract the files and copy them to the /Objects/res/drawable folder of the B4A project (make sure they are set to READ ONLY)
Some sample code:
B4X:
#Region Project Attributes
#ApplicationLabel: FAImageView
#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.
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 faiv1 As FAImageView
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")
faiv1.Interval = 100
faiv1.Looping = True
Dim framenames() As String = Array As String("frame01", "frame02", "frame03", "frame04", "frame05", _
"frame06", "frame07", "frame08", "frame09", "frame10")
faiv1.addImageFrame(framenames)
faiv1.startAnimation
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
faiv1.stopAnimaion
End Sub
The library:
FAImageView
Author: Johan Schoeman
Version: 1
- FAImageView
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)
- addImageFrame (draw() As String)
- reset
- startAnimation
- stopAnimaion
- AnimationRepeatCount As Int [write only]
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Interval As Int [write only]
set inteval in milli seconds - Left As Int
- Looping As Boolean [write only]
- RestoreFirstFrameWhenFinishAnimation As Boolean [write only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int