B4A Library AutoLinkTextView

Enjoy this beautiful TextView from B4A https://github.com/armcha/AutoLinkTextView

screen1.png


NOTE : @DependsOn(values={"android-support-v4"})
AutoLinkTextView
Author:
SMM
Version: 0.01
  • AutoLinkTextView
    Events:
    • _click (autoLinkMode As String, matchedText As String)
    Fields:
    • MODE_CUSTOM As String
    • MODE_EMAIL As String
    • MODE_HASHTAG As String
    • MODE_MENTION As String
    • MODE_PHONE As String
    • MODE_URL As String
    • ba As BA
    Methods:
    • BringToFront
    • 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)
    • addMode (mode() As String)
      Use String fields like MODE_HASHTAG
    Properties:
    • AutoLinkText As String [write only]
    • Background As Drawable
    • Color As Int [write only]
    • CustomModeColor As Int [write only]
    • CustomRegex As String [write only]
    • EmailModeColor As Int [write only]
    • Enabled As Boolean
    • HashtagModeColor As Int [write only]
    • Height As Int
    • Left As Int
    • MentionModeColor As Int [write only]
    • Parent As Object [read only]
    • PhoneModeColor As Int [write only]
    • SelectedStateColor As Int [write only]
    • Tag As Object
    • Top As Int
    • UrlModeColor As Int [write only]
    • Visible As Boolean
    • Width As Int



Sample

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim altv As AutoLinkTextView
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")
    altv.Initialize("altv")
    altv.HashtagModeColor=Colors.Red
    altv.MentionModeColor=Colors.Green
    altv.addMode(Array As String(altv.MODE_MENTION,altv.MODE_HASHTAG))
    altv.AutoLinkText="This is a #hashtag and this is not a @mention."
    Activity.AddView(altv,0,0,100%x,100%y)
   
End Sub
Sub altv_click(autoLinkMode As String,matchedText As String)
    Log(autoLinkMode&CRLF&matchedText)
End Sub
 

Attachments

  • AutoLinkTextView.zip
    12.8 KB · Views: 308
Top