B4A Library TitanicTextView

It wraps this Github project. Posting:

1. B4A project
2. The B4A library files
3. The Java code








Sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: TitanicTextView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #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 ttv1 As TitanicTextView
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")
   
    ttv1.SetTitanicText("B4X is a super development tool...")
    ttv1.TextSize = 70
    ttv1.TextColor = Colors.red
    ttv1.Gravity = Gravity.CENTER
    ttv1.WaveXanimationDuration = 0
    ttv1.WaveYanimationDuration = 5000
    ttv1.startWave
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

TitanicTextView
Author:
Github: Romain Piel, Wrapper: Johan Schoeman
Version: 1

  • Methods:
    • get (c As Context, assetPath As String) As Typeface
  • TitanicTextView
    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)
    • SetTextColorAnimated (arg0 As Int, arg1 As Int)
    • SetTextSizeAnimated (arg0 As Int, arg1 As Float)
    • SetTitanicText (stt As String)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • isSetUp As Boolean
    • isSinking As Boolean
    • startWave
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Gravity As Int
    • Height As Int
    • Left As Int
    • MaskX As Float
    • MaskY As Float
    • Sinking As Boolean [write only]
    • Tag As Object
    • Text As String
    • TextColor As Int
    • TextSize As Float
    • Top As Int
    • Typeface As Typeface
    • Visible As Boolean
    • WaveXanimationDuration As Int [write only]
    • WaveYanimationDuration As Int [write only]
    • Width As Int
 

Attachments

  • TitanicTextViewLibFiles.zip
    10.7 KB · Views: 357
  • TheJavaCode.zip
    39.4 KB · Views: 352
  • b4aTitanicTextView.zip
    11.9 KB · Views: 348

LucaMs

Expert
Licensed User
Longtime User
Hi, Johan.

I tried your library.

Using a simple layout (just one view, centered by scripts) I get an error (a)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)



Another error if I don't use layouts but I add the view by code (b)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1161)
at android.content.res.Resources.getDrawable(Resources.java:699)
at main.java.com.romainpiel.titanic.library.TitanicTextView.createShader(TitanicTextView.java:140)



Thank you
 

Attachments

  • a TitanicTextView.zip
    7.8 KB · Views: 286
  • b TitanicTextView.zip
    6.9 KB · Views: 317

Johan Schoeman

Expert
Licensed User
Longtime User
Check project in post #1. There is a file called "wave.png" in the /Objects/drawable folder that are missing from both your (a) and (b) postings above. This file needs to be in the drawable folder and set to READ ONLY
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…