mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 18:36:21 +03:00
Address another possible BetterLinkMovementMethod crash
https://github.com/SchildiChat/SchildiChat-android-rageshakes/issues/1152 Well... it says it happened on longclick, but it doesn't say if it happened in SafeBetterLinkMovementMethod or EvenBetterLinkMovementMethod, but since we're not using it plain as far as I see, it should be one of these, and SafeBetterLinkMovementMethod has it already caught? Change-Id: Ifa171203b4e65a49a89121ddd2fb714d5bcb0d64
This commit is contained in:
parent
97dc744db3
commit
a411437d53
1 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,7 @@ import android.text.style.ClickableSpan
|
||||||
import android.text.style.URLSpan
|
import android.text.style.URLSpan
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import me.saket.bettermovementmethod.BetterLinkMovementMethod
|
import me.saket.bettermovementmethod.BetterLinkMovementMethod
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
class EvenBetterLinkMovementMethod(private val onLinkClickListener: OnLinkClickListener? = null) : BetterLinkMovementMethod() {
|
class EvenBetterLinkMovementMethod(private val onLinkClickListener: OnLinkClickListener? = null) : BetterLinkMovementMethod() {
|
||||||
|
|
||||||
|
@ -50,4 +51,12 @@ class EvenBetterLinkMovementMethod(private val onLinkClickListener: OnLinkClickL
|
||||||
clickableSpan.onClick(textView)
|
clickableSpan.onClick(textView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun dispatchUrlLongClick(textView: TextView?, clickableSpan: ClickableSpan?) {
|
||||||
|
try {
|
||||||
|
super.dispatchUrlLongClick(textView, clickableSpan)
|
||||||
|
} catch (e: StringIndexOutOfBoundsException) {
|
||||||
|
Timber.w("BetterLinkMovement dispatchUrlLongClick StringIndexOutOfBoundsException $e")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue