B4A Library TextViewExpandableAnimation

A wrapper with some modifications to this GitHub project https://github.com/freecats/TextViewExpandableAnimation

Expandable TextView With Smooth Transition Animation

preview.gif



NOTE
:
B4X:
@DependsOn(values={"android-support-v4"})

TextViewExpandableAnimation
Author:
SMM
Version: 0.01
  • TextViewExpandableAnimation
    Events:
    • click
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • Initialize (EventName As String, TextSize As Float)
    • 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
    • BackgroundColor As Int [write only]
    • Color As Int [write only]
    • DrawableExpand As Drawable
    • DrawableShrink As Drawable
    • Enabled As Boolean
    • ExpandLines As Int
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • SleepTime As Int
    • Tag As Object
    • Text As String [write only]
    • TextContent As String [read only]
    • TextContentColor As Int [write only]
    • TextContentSize As Float [write only]
    • TextExpand As String [write only]
    • TextShrink As String [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int

OK , I admit it I have a problem with textsize :D so it works better if set in Initialize method .
 

Attachments

  • TextViewExpandableAnimation.zip
    13.2 KB · Views: 247
  • res.zip
    33.6 KB · Views: 251

MarcoRome

Expert
Licensed User
Longtime User
I tried it seems that "TextContentColor" don't work.
As you see also if i insert Colors.White dont happen nothing.
B4X:
#AdditionalRes: ..\res

......


Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim test As TextViewExpandableAnimation
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")
    test.Initialize("test", 30.0)
    test.ExpandLines = 5
    test.TextExpand = "Espandi"
    test.TextShrink ="Riduci"
    test.TextContentColor = Colors.White '<------ Dont Work ??
    test.TextContentSize = 12.0
    test.Text = $"Prima riga
seconda riga
terza riga
quarta riga
quinta riga
sesta riga
settima riga
ottava riga
nona riga
decima riga
undicesima riga
dodicesima riga"$
   
    Activity.AddView(test, 10dip, 10dip, 90%x, 50%y)

2016-08-28 06.39.52.png
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Fantastic work @somed3v3loper .
Is it possibile also a little example in B4A ?
Here is a sample which is not the best by the way just to test the view :D
B4X:
Dim ref As TextViewExpandableAnimation
    ref.Initialize("ref",50)
    ref.TextContentSize=300
       
    ref.TextShrink="Shrink"
    ref.TextExpand="Expand"
    Activity.AddView(ref,0%x,20%y,100%x,70%y)
    ref.ExpandLines=3
    ref.Text="HERE IS ONE LINE"&"ANOTHER ONE"&"ANOTHER ONE"&CRLF&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&CRLF&"ANOTHER ONE" _
    &"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE" _
    &"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"&"ANOTHER ONE"
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I tried it seems that "TextContentColor" don't work.
As you see also if i insert Colors.White dont happen nothing.
I am not sure why it does not work . Perhaps it was programmed to get its values from xml ?
I added a public method to original java lib to change internal value but it does not work as it should .
Any hint is appreciated .
 
Top