removing android version bypass for using text futures

- the emoji span changes affect all android versions
This commit is contained in:
Adam Brown 2021-12-20 10:09:17 +00:00
parent c6a118fc1f
commit f1dff33dc2
1 changed files with 4 additions and 7 deletions

View File

@ -16,7 +16,6 @@
package im.vector.app.features.html package im.vector.app.features.html
import android.os.Build
import android.text.Spanned import android.text.Spanned
import android.text.style.MetricAffectingSpan import android.text.style.MetricAffectingSpan
import android.text.style.StrikethroughSpan 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 { 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 return spanned
.getSpans(0, spanned.length, Any::class.java) .getSpans(0, spanned.length, Any::class.java)
.all { it !is StrikethroughSpan && it !is UnderlineSpan && it !is MetricAffectingSpan } .all { it !is StrikethroughSpan && it !is UnderlineSpan && it !is MetricAffectingSpan }