mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-16 03:08:58 +03:00
Fix rendering replies after fixing pills
Change-Id: I5f29a1e64ab681337b08cc8a21ba9b735e10b41e
This commit is contained in:
parent
3d39699542
commit
3ce5b3b10b
1 changed files with 7 additions and 1 deletions
|
@ -87,8 +87,14 @@ class PillsPostProcessor @AssistedInject constructor(
|
|||
// GlideImagesPlugin causes duplicated pills if we have a nested image: https://github.com/SchildiChat/SchildiChat-android/issues/148
|
||||
// Same can happen for other spans: https://github.com/SchildiChat/SchildiChat-android/issues/156
|
||||
// -> Remove all spans from pill content before rendering
|
||||
renderedText.getSpans(startSpan, endSpan, Any::class.java).forEach {
|
||||
renderedText.getSpans(startSpan, endSpan, Any::class.java).forEach remove@{
|
||||
if (it !is LinkSpan) {
|
||||
// Make sure to only remove spans that are contained in this link, and not are bigger than this link, e.g. like reply-blocks
|
||||
val start = renderedText.getSpanStart(it)
|
||||
if (start < startSpan) return@remove
|
||||
val end = renderedText.getSpanEnd(it)
|
||||
if (end > endSpan) return@remove
|
||||
|
||||
renderedText.removeSpan(it)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue