B4A Library ImageTextView

It is a warp for this Github project (my 100th library wrapper).Posting the following:

1. B4A sample project)
2. B4A library files
3. Other jar files required - download the from HERE and copy them to your additional library folder
4. The Java code - do with it as you like (only the src folder - you will need a libs folder on the same folder level as the src folder. Copy all the jars downloaded from (3) above into this libs folder before you compile the Java code
5. AdditionalLibsResource.zip - extract it and copy the complete resource folder to your additional library folder so that the resource folder is in the "root" of your additional library folder.

1.png


Make sure you set the following correctly in your B4A code (the below reflects my settings):

B4X:
#AdditionalRes: C:\Users\----------2\Documents\Basic 4 Android\JOHAN APPS\JHS LIBS\resource\b4a_appcompat, de.amberhome.objects.appcompat

#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design

Sample Code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: ImageTextView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\resource

#AdditionalRes: C:\Users\----------2\Documents\Basic 4 Android\JOHAN APPS\JHS LIBS\resource\b4a_appcompat, de.amberhome.objects.appcompat

#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design

#ExcludeClasses: .games, .drive, .ads, .fitness, .wearable, .measurement, .cast, .auth, .nearby
#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .gcm, .maps, .panorama

#Extends: android.support.v7.app.AppCompatActivity

#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 itv1, itv2, itv3, itv4, itv5, itv6 As ImageTextView
    Dim mbmd As BitmapDrawable
    Dim mbm 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")
   
    itv1.ImageTitle = "Brooke Shields"
    itv1.ImageSubTitle = "Actress"
    itv1.ImageTitleColor = Colors.Green
    itv1.ImageTitleTextSize = 20
    itv1.ImageSubTitleColor = Colors.Yellow
    itv1.ImageSubTitleTextSize = 15
    mbm.Initialize(File.DirAssets,"brooke.png")
    mbmd.Initialize(mbm)
    itv1.ImageDrawable = mbmd
   

    itv2.ImageTitle = "Angelina Jolie"
    itv2.ImageSubTitle = "Actress"
    itv2.ImageTitleColor = Colors.Red
    itv2.ImageTitleTextSize = 20
    itv2.ImageSubTitleColor = Colors.Blue
    itv2.ImageSubTitleTextSize = 15
    mbm.Initialize(File.DirAssets,"angelina.png")
    mbmd.Initialize(mbm)
    itv2.ImageDrawable = mbmd
   
    itv3.ImageTitle = "Charlize Theron"
    itv3.ImageSubTitle = "Actress"
    itv3.ImageTitleColor = Colors.Magenta
    itv3.ImageTitleTextSize = 20
    itv3.ImageSubTitleColor = Colors.Cyan
    itv3.ImageSubTitleTextSize = 15
    mbm.Initialize(File.DirAssets,"charlize1.jpg")
    mbmd.Initialize(mbm)
    itv3.ImageDrawable = mbmd   
   
    itv4.ImageTitle = "Unknown woman"
    itv4.ImageSubTitle = "Sits at home all day long"
    itv4.ImageTitleColor = Colors.Magenta
    itv4.ImageTitleTextSize = 20
    itv4.ImageSubTitleColor = Colors.Cyan
    itv4.ImageSubTitleTextSize = 15
    mbm.Initialize(File.DirAssets,"female.png")
    mbmd.Initialize(mbm)
    itv4.ImageDrawable = mbmd   
   
    itv5.ImageTitle = "Unknown man"
    itv5.ImageSubTitle = "Lazy as what you can get"
    itv5.ImageTitleColor = Colors.Cyan
    itv5.ImageTitleTextSize = 20
    itv5.ImageSubTitleColor = Colors.Magenta
    itv5.ImageSubTitleTextSize = 15
    mbm.Initialize(File.DirAssets,"male.png")
    mbmd.Initialize(mbm)
    itv5.ImageDrawable = mbmd       
   
    itv6.ImageTitle = "A cat..."
    itv6.ImageSubTitle = "...but not my cat"
    itv6.ImageTitleColor = Colors.White
    itv6.ImageTitleTextSize = 20
    itv6.ImageSubTitleColor = Colors.LightGray
    itv6.ImageSubTitleTextSize = 15
    mbm.Initialize(File.DirAssets,"cat.png")
    mbmd.Initialize(mbm)
    itv6.ImageDrawable = mbmd       
   
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Library

ImageTextView
Author:
Github: Vipin Agrahari, Wrapped by: Johan Schoeman
Version: 1
  • ImageTextView
    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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • ImageDrawable As Drawable [write only]
    • ImageSubTitle As String [write only]
    • ImageSubTitleColor As Int [write only]
    • ImageSubTitleTextSize As Int [write only]
    • ImageTitle As String [write only]
    • ImageTitleColor As Int [write only]
    • ImageTitleTextSize As Int [write only]
    • Left As Int
    • Parent As Object [read only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int

Please note that this project uses the face detector of the Google Mobile Vision API and might not work with all faces other than human faces. I tried the cat and it worked....
 

Attachments

  • AdditionalLibsResource.zip
    775 bytes · Views: 321
  • b4aImageTextView.zip
    270.2 KB · Views: 349
  • TheJavaCode.zip
    11.2 KB · Views: 330
  • b4aLibFiles.zip
    10 KB · Views: 332

jahswant

Well-Known Member
Licensed User
Longtime User
Please note that this project uses the face detector of the Google Mobile Vision API and might not work with all faces other than human faces. I tried the cat and it worked....
I want to cry because i have no time and have to proove in my new job...Courage...
 
Top