-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use TableLayout for anime details
- Loading branch information
Showing
7 changed files
with
266 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.mrikso.anitube.app.utils | ||
|
||
import android.text.SpannableString | ||
import android.text.Spanned | ||
import android.text.style.ClickableSpan | ||
import android.view.View | ||
|
||
fun makeLinks( | ||
text: String, | ||
phrase: String, | ||
/* phraseColor: Int,*/ | ||
listener: View.OnClickListener | ||
): SpannableString { | ||
val spannableString = SpannableString(text) | ||
val clickableSpan = object : ClickableSpan() { | ||
/*override fun updateDrawState(ds: TextPaint) { | ||
// ds.color = phraseColor // you can use custom color | ||
ds.isUnderlineText = false // this remove the underline | ||
}*/ | ||
override fun onClick(view: View) { | ||
listener.onClick(view) | ||
} | ||
} | ||
val start = text.indexOf(phrase) | ||
val end = start + phrase.length | ||
spannableString.setSpan( | ||
clickableSpan, | ||
start, | ||
end, | ||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | ||
) | ||
return spannableString | ||
} |
Oops, something went wrong.