mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Merge pull request #4770 from vector-im/feature/adm/emoji-27-and-below-crash
Fixing Android 8.1.1 / 27 and below emoji crash
This commit is contained in:
commit
721bf4fbd1
2 changed files with 5 additions and 7 deletions
1
changelog.d/4769.bugfix
Normal file
1
changelog.d/4769.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fixing emoji related crashes on android 8.1.1 and below
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package im.vector.app.features.html
|
||||
|
||||
import android.os.Build
|
||||
import android.text.Spanned
|
||||
import android.text.style.MetricAffectingSpan
|
||||
import android.text.style.StrikethroughSpan
|
||||
|
@ -41,13 +40,11 @@ class SpanUtils @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
// Workaround for https://issuetracker.google.com/issues/188454876
|
||||
/**
|
||||
* TextFutures do not support StrikethroughSpan, UnderlineSpan or MetricAffectingSpan
|
||||
* Workaround for https://issuetracker.google.com/issues/188454876
|
||||
*/
|
||||
private fun canUseTextFuture(spanned: Spanned): Boolean {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
// On old devices, it works correctly
|
||||
return true
|
||||
}
|
||||
|
||||
return spanned
|
||||
.getSpans(0, spanned.length, Any::class.java)
|
||||
.all { it !is StrikethroughSpan && it !is UnderlineSpan && it !is MetricAffectingSpan }
|
||||
|
|
Loading…
Reference in a new issue