Skip to content

rasel6999/RDxTextview

Repository files navigation

RDxTextview is the Advanced Android TextView with super optimize


Support Bulletin Board Code (BBCode)

    [b]  Bold text  [/b]
    [i]  Italic text  [/i]
    [u]  Underline text  [/u]
    [img] image url [/img]
    [big] Big text[/big]
    [quote]  Blockquote text  [/quote]
    [color=red]  change text color  [/color]
    [url=htts://example.com] url link [/url]
    [user=1] user name [/user]
    Hashtags (#)
    Mentions (@)
    URLs (https://)
    Phone Numbers
    Emails


Support all pre-loaded html tags

  • <p>
  • <ul>
  • <li>
  • <div>
  • <span>
  • <strong>
  • <b>
  • <em>
  • <cite>
  • <dfn>
  • <i>
  • <big>
  • <small>
  • <font>
  • <blockquote>
  • <tt>
  • <a>
  • <u>
  • <del>
  • <s>
  • <strike>
  • <sup>
  • <sub>
  • <h1>
  • <h2>
  • <h3>
  • <h4>
  • <h5>
  • <h6>
  • <img>
  • <br>
  • The current minSDK version is API level 14.

    Setup and Usage

    Gradle: in app

     implementation 'com.github.rasel6999:RDxTextview:{latest version}'

    add maven if not availeble?

       maven { url "https://jitpack.io" } 
    

    Add RDxTextView to your layout

               <com.macwap.rasel.rdxTextView.RDxTextView
                    android:id="@+id/tvRDX"
                    android:textSize="17sp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
    val rdxTextView:RDxTextView? = findViewById(R.id.tvRDX);
    

    Add one or multiple modes

    rdxTextView?.addMode(ModeBBCode, ModeBBImg, ModeMention,
    ModeBBUser, ModeHashtag, ModeUrl, ModeBBUrl, ModeEmail, ModePhone)

    Support Mode

  • ModeBBCode -> for [b] [/b] , [i] [/i] , [u] [/u] , [big] [/big] , [quote] [/quote] ,
  • ModeBBImg -> for [img] [/img]
  • ModeMention -> for @name
  • ModeBBUser -> for [user=id] [/user]
  • ModeHashtag -> for #hashtag
  • ModeUrl -> for http://example.com support html link
  • ModeBBUrl -> for [url=link] [/url]
  • ModeEmail -> for mail [email protected]
  • ModePhone -> for +968-98 58 70 40
  • ModeImageDisable-> for Disable tag image loading

    Setup Custom color for mode

               rdxTextView?.mentionModeColor = ContextCompat.getColor(this,R.color.teal_700)
               rdxTextView?.hashTagModeColor = ContextCompat.getColor(this,R.color.purple_700)
               rdxTextView?.urlModeColor = ContextCompat.getColor(this,R.color.blue)
               rdxTextView?.emailModeColor = ContextCompat.getColor(this,R.color.blue)

    Support Custom Color for mode

  • mentionModeColor
  • hashTagModeColor
  • userBbModeColor
  • emailModeColor
  • phoneModeColor
  • urlModeColor
  • urlBbModeColor

    You are Done. just set text in view

            rdxTextView?.text = grdxTextView?.text
    

    Set RDxTextView click listener

          rdxTextView?.onRDxClick { item: RDxLinkItem ->
               if(item.mode==ModeUrl){
                  /// do any thing you want
    
                } 
                
                
              Toast.makeText(this,"" +
                      "Mode = ${item.mode?.modeName}," +
                      " originalText = ${item.originalText}," +
                      " parameterText = ${item.parameterText}," +
                      " valueText = ${item.valueText}," +
                      "   . ", Toast.LENGTH_LONG).show()
    
          }