forked from GitHub-Mirror/riotX-android
fix / review
This commit is contained in:
parent
471170a3e0
commit
1b3ec2d0fb
@ -17,9 +17,6 @@
|
|||||||
package im.vector.matrix.android.api.permalinks
|
package im.vector.matrix.android.api.permalinks
|
||||||
|
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableString
|
|
||||||
import android.text.method.LinkMovementMethod
|
|
||||||
import android.widget.TextView
|
|
||||||
import im.vector.matrix.android.api.MatrixPatterns
|
import im.vector.matrix.android.api.MatrixPatterns
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,36 +54,4 @@ object MatrixLinkify {
|
|||||||
return hasMatch
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -44,7 +44,7 @@ abstract class MessageTextItem : AbsMessageItem<MessageTextItem.Holder>() {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
it.setOnLinkLongClickListener { textView, url ->
|
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
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user