fix / review

This commit is contained in:
Valere 2019-06-07 13:38:58 +02:00
parent 471170a3e0
commit 1b3ec2d0fb
2 changed files with 2 additions and 37 deletions

View file

@ -17,9 +17,6 @@
package im.vector.matrix.android.api.permalinks
import android.text.Spannable
import android.text.SpannableString
import android.text.method.LinkMovementMethod
import android.widget.TextView
import im.vector.matrix.android.api.MatrixPatterns
/**
@ -57,36 +54,4 @@ object MatrixLinkify {
return hasMatch
}
// fun addLinks(textView: TextView, callback: MatrixPermalinkSpan.Callback?): Boolean {
// val text = textView.text
// if (text is Spannable) {
// if (addLinks(text, callback)) {
// addLinkMovementMethod(textView)
// return true
// }
//
// return false
// } else {
// val spannableString = SpannableString.valueOf(text)
// if (addLinks(spannableString, callback)) {
// addLinkMovementMethod(textView)
// textView.text = spannableString
// return true
// }
// return false
// }
// }
/**
* Add linkMovementMethod on textview if not already set
* @param textView the textView on which the movementMethod is set
*/
fun addLinkMovementMethod(textView: TextView) {
val movementMethod = textView.movementMethod
if (movementMethod == null || movementMethod !is LinkMovementMethod) {
if (textView.linksClickable) {
textView.movementMethod = LinkMovementMethod.getInstance()
}
}
}
}

View file

@ -44,7 +44,7 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
false
}
it.setOnLinkLongClickListener { textView, url ->
//Long clicks are handled by parent, return false to block android to do something with url
//Long clicks are handled by parent, return true to block android to do something with url
true
}
}