B4A Library IconicFontEngine (EditText, Button and TextView)

This is a wrapper for this github project.

I´m posting here the Lib, an example and the java-source

The Lib is using the new Custom Properties which can be used in designer in V5.8
So you need B4A 5.8+ to use this library

IconicFontEngine
Author:
DonManfred (wrapper)
Version: 2
  • IconicFontButton
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • 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
    • FontAwesomeList As IterableList [read only]
    • Height As Int
    • Left As Int
    • MaterialIconsList As IterableList [read only]
    • Tag As Object
    • Text As CharSequence [write only]
    • Top As Int
    • TypeIconList As IterableList [read only]
    • Visible As Boolean
    • Width As Int
  • IconicFontEditText
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • 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
    • FontAwesomeList As IterableList [read only]
    • Height As Int
    • Hint As CharSequence [write only]
    • Left As Int
    • MaterialIconsList As IterableList [read only]
    • Tag As Object
    • Text As CharSequence [write only]
    • Top As Int
    • TypeIconList As IterableList [read only]
    • Visible As Boolean
    • Width As Int
  • IconicFontTextView
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • 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
    • FontAwesomeList As IterableList [read only]
    • Height As Int
    • Left As Int
    • MaterialIconsList As IterableList [read only]
    • Tag As Object
    • Text As CharSequence [write only]
    • Top As Int
    • TypeIconList As IterableList [read only]
    • Visible As Boolean
    • Width As Int

If you want to donate for my work building the wrapper you can do it here:

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private iconicBtn As IconicFontButton
    Private iconicEdit As IconicFontEditText
    Private IconicLabel As IconicFontTextView
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("Layout1")
    Log(iconicBtn.FontAwesomeList)
    Log(iconicBtn.TypeIconList)
    '
    ' These two methods (FontAwesomeList and TypeIconList) are available in either
    ' IconicFontButton, IconicFontEditText and IconicFontTextView
    '
    iconicBtn.Text = "Test-Github {fa-github}"
    iconicEdit.Text = "{typcn-anchor}{typcn-social-github-circular}"
    iconicEdit.Hint = "{typcn-anchor}"
    IconicLabel.Text = "{fa-github}{typcn-social-github-circular}"

End Sub

Please note the additional folder "fonts" inside the Files folder of the Example-project! The fonts used are inside this folder.

New in V2.0
- Added the MaterialIconsFont to the set.
 

Attachments

  • IconicFontEngineEx.zip
    184.9 KB · Views: 550
  • IconicFontEngineJAVA-Source.zip
    25.3 KB · Views: 469
  • libIconicFontEngineV2.0.0.zip
    49.2 KB · Views: 502
Last edited:

Anser

Well-Known Member
Licensed User
Longtime User
Screen snapshot of the above posted example application that uses the lib LibIconicFontEngine.

Sample_Screen.png


Regards

Anser
 

Kwame Twum

Active Member
Licensed User
Longtime User
I keep getting: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException when I run the example.
Error happens on
B4X:
Activity.LoadLayout("layouthere")
happens even with the example
 

Kwame Twum

Active Member
Licensed User
Longtime User
Post the full stacktrace please

** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 31)
Activity.LoadLayout("Layout1")
java.lang.NoSuchMethodError: anywheresoftware.b4a.objects.CustomViewWrapper.replaceBaseWithView
at de.donmanfred.IconicFontButtonWrapper.DesignerCreateView(IconicFontButtonWrapper.java:69)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:60)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at b4a.example.main._activity_create(main.java:346)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
 
Top