B4A Library Android-Combined-Avatar

The attached project wraps this Github project. You will need to have a recent version of android-support-v4.jar in your additional library folder. You can download it from HERE. Posting the following:

1. B4A project
2. B4A library files
3. Java source code (you will have to add a libs folder on the same folder level as the src folder and copy android-support-v4.jar into this libs folder before you can compile the Java project with SLC or Eclipse into a jar/xml.



Note: you can pass a maximum of 5 bitmaps via a list to the library per customview

Sample Code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aAndroidCombinedAvatar
    #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 aca1, aca2 As AndroidCombinedAvatar
    Dim bm(5) As Bitmap
    Dim bm2(4) As Bitmap

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")

    Dim l, l2 As List
    l.Initialize
    l2.Initialize

    bm(0).Initialize(File.DirAssets,"pluto.jpg")
    bm(1).Initialize(File.DirAssets,"stitch.jpg")
    bm(2).Initialize(File.DirAssets,"File_062_1.jpg")
    bm(3).Initialize(File.DirAssets,"Chris.jpg")
    bm(4).Initialize(File.DirAssets,"Stitch1.jpg")
            
    l.Add(bm(0))
    l.Add(bm(1))
    l.add(bm(2))
    l.add(bm(3))
    l.add(bm(4))

    aca1.ImageBitmaps = l

    bm2(0).Initialize(File.DirAssets,"a.jpg")
    bm2(1).Initialize(File.DirAssets,"b.jpg")
    bm2(2).Initialize(File.DirAssets,"c.jpg")
    bm2(3).Initialize(File.DirAssets,"d.jpg")
    
    l2.Add(bm2(0))
    l2.Add(bm2(1))
    l2.add(bm2(2))
    l2.add(bm2(3))

    aca2.ImageBitmaps = l2

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Library:

AndroidCombinedAvatar
Author:
Github: kongnanlive, Wrapped by: Johan Schoeman
Version: 1
  • AndroidCombinedAvatar
    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)
    • size2 (count As Int) As Float[]
    • size3 (count As Int) As Float[]
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • ImageBitmaps As ArrayList [write only]
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • AndroidCombinedAvatarLibFiles.zip
    7.9 KB · Views: 398
  • b4aAndroidCombinedAvatar.zip
    396 KB · Views: 436
  • TheJavaCode.zip
    5.4 KB · Views: 367
Cookies are required to use this site. You must accept them to continue using the site. Learn more…