B4A Library Linker

This is a wrap for this Github Project.

Linker

Lightweight android library for
highlighting sections of a textview

Author: DonManfred
Version: 0.01
  • LinkProfile
    • Functions:
      • Initialize (charSequence As String, linkColor As Int, underlineMode As Boolean)
      • IsInitialized As Boolean
    • Properties:
      • LinkColor As Int
      • UnderlineMode As Boolean
  • Linker
    • Events:
      • onLinkClick (charSequenceClicked As String)
    • Functions:
      • addProfiles (list As java.util.List)
      • addStrings (strings As java.util.List)
      • clearLinksList
      • Initialize (EventName As String, txtView As android.widget.TextView)
      • setLinkColorForCharSequence (charSequenceIn As String, color As Int)
      • setUnderlineModeForCharSequence (charSequenceIn As String, whether As Boolean)
      • update
    • Properties:
      • AllLinkColors As Int [write only]
      • AllLinkUnderline As Boolean [write only]
      • Profiles As java.util.ArrayList [read only]

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Public linker As Linker
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 lblText As Label
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")
    lblText.Text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
    linker.Initialize("Linker",lblText)
    Dim l As List
    l.Initialize
    Dim link As LinkProfile
    link.Initialize("Lorem ipsum dolor",Colors.Red,True)
    l.Add(link)
   
    Dim link As LinkProfile
    link.Initialize("consetetur sadipscing elitr",Colors.Blue,True)
    l.Add(link)

    Dim link As LinkProfile
    link.Initialize("sed diam",Colors.Yellow,True)
    l.Add(link)

    Dim tl As List
    tl.Initialize
    tl.Add("sed diam voluptua")
    linker.addProfiles(l)
    linker.addStrings(tl)
    linker.update
End Sub
Sub Linker_onLinkClick(charSequenceClicked As String)
    Log($"Linker_onLinkClick(${charSequenceClicked})"$)
End Sub

WhatsApp Image 2019-04-16 at 18.38.56.jpeg
 

Attachments

  • LinkerEx.zip
    9.2 KB · Views: 341
  • LinkerV0.01.zip
    9.5 KB · Views: 344
Last edited:
Top