B4A Library RevealTextView

It wraps this Github project. Posting the following:
1. B4A project
2. B4A library files (2 x Jar and 1 x XML) - copy them to your additional library folder
3. The Java source code

0.png


1.png


2.png


3.png


Sample Code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aRevealTextView
    #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.
   
    Dim t As Timer

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 rtv1 As RevealTextView
    Private rtv2 As RevealTextView
    Private rtv3 As RevealTextView
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")
    t.Initialize("t", 5000)
   
    rtv1.RevealText = "Hello B4A"
    rtv1.RevealTextColor = Colors.Red
    rtv1.RevealTextSize = 30
    rtv1.RevealAnimationDuration = 4500
   
    rtv2.RevealText = "Hello B4J"
    rtv2.RevealTextColor = Colors.Green
    rtv2.RevealTextSize = 35
    rtv2.RevealAnimationDuration = 4000
   
    rtv3.RevealText = "Hello B4I"
    rtv3.RevealTextColor = Colors.Yellow
    rtv3.RevealTextSize = 40
    rtv3.RevealAnimationDuration = 3500   
   
End Sub

Sub Activity_Resume
   
    t.Enabled = True
   
End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
    t.Enabled = False

End Sub

Sub t_tick
   
    rtv1.RUN   
    rtv2.RUN
    rtv3.RUN
   
End Sub

Library:

RevealTextView
Author:
Github: Antonio Nicolas Pina, Wrapped by: Johan Schoeman
Version: 1
  • RevealTextView
    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
    • RUN
    • 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
    • Left As Int
    • RevealAnimationDuration As Int [write only]
    • RevealText As String [write only]
    • RevealTextColor As Int [write only]
    • RevealTextSize As Float [write only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • b4aRevealTextView.zip
    8 KB · Views: 260
  • RevealTextViewLibFiles.zip
    18.4 KB · Views: 262
  • TheJavaCode.zip
    24.6 KB · Views: 271

LucaMs

Expert
Licensed User
Longtime User
Hi, Johan.

I think this library needs some change.

a) it crashes if you set a text longer than 11 characters (RevealText)
b) the animation starts anyway, even if you don't start it explicitly (RUN)
c) there is a default text to delete (Hello World)
d) setting the view top position using VerticalCenter the position will be wrong
e) a "RevealTextAnimationEnd" event would be helpful


Thank you for your great work on this site!
 
Last edited:

PoleStar

Member
Licensed User
Longtime User
Hi
Thanks for share :)
This version has many faults
If you can submit a new version,Please
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi, Johan.

I think this library needs some change.

a) it crashes if you set a text longer than 11 characters (RevealText) - Sorted - make the text as long as you like
b) the animation starts anyway, even if you don't start it explicitly (RUN) - It only starts with the call to RUN. If you want the animation to stop then stop the timer
c) there is a default text to delete (Hello World) - Sorted
d) setting the view top position using VerticalCenter the position will be wrong - Use B4A code or Designer code as in the attached project to position the customview
e) a "RevealTextAnimationEnd" event would be helpful - The original Github code does not provide for this. Attached is the Java code (original + wrapper). Change it to whatever will suite you.


Thank you for your great work on this site!
New lib files attached - make the string as long as you like. Note that the call to RUN has changed to startAnimation.

1.png
 

Attachments

  • b4aRevealTextView.zip
    8.1 KB · Views: 226
  • TheJavaCode.zip
    24.7 KB · Views: 238
  • RevealTextViewLibFiles.zip
    18.4 KB · Views: 245
Top