B4A Library FAImageView

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)

1.png


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
    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)
    • addImageFrame (draw() As String)
    • reset
    • startAnimation
    • stopAnimaion
    Properties:
    • 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
 

Attachments

  • frame02.zip
    447.8 KB · Views: 271
  • frame05.zip
    457.6 KB · Views: 263
  • frame08.zip
    449.8 KB · Views: 267
  • frame10.zip
    147.6 KB · Views: 256
  • b4aFAImageView.zip
    7.7 KB · Views: 253
  • FAImageViewLibFiles.zip
    13.2 KB · Views: 262
  • TheJavaCode.zip
    7.1 KB · Views: 255

walterf25

Expert
Licensed User
Longtime User
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)

View attachment 38513

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
    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)
    • addImageFrame (draw() As String)
    • reset
    • startAnimation
    • stopAnimaion
    Properties:
    • 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
Very nice, but there isn't really a need for a library to animate images, it can be done without the library, but nice contribution.

Cheers,
Walter
 

Johan Schoeman

Expert
Licensed User
Longtime User
Very nice, but there isn't really a need for a library to animate images, it can be done without the library, but nice contribution.

Cheers,
Walter
Shame...doggie was sitting there all alone in the Github Forum and kept on shouting "I also want to go to the B4A forum!". So, I wrapped the doggie so that he can reunite with his Github mates that were already transferred to the B4A forum. Doggie is now a very happy teddy bear...;)
 

walterf25

Expert
Licensed User
Longtime User
Shame...doggie was sitting there all alone in the Github Forum and kept on shouting "I also want to go to the B4A forum!". So, I wrapped the doggie so that he can reunite with his Github mates that were already transferred to the B4A forum. Doggie is now a very happy teddy bear...;)
Well in that case, welcome to the B4A family Doggie, you can now play with my puppy Rascal.
SavedImage_20151012_122403_02.jpg
 

Johan Schoeman

Expert
Licensed User
Longtime User
Very nice, but there isn't really a need for a library to animate images, it can be done without the library, but nice contribution.

Cheers,
Walter
Is it possible to do it with B4A only without using an external library making use of only 5 lines of B4A code?
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Hi, is it possible to specify the path of the frames to add e.g. frame1 = File.DirInternat & "frame1.jpg", I'd like to add my own frames during runtime with different files. Perhaps use a list first to create the references?
Will look into it @Mashiane - sure it can be done.
 
Top