mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Fix bullet points not having leading margin on timeline items (#4536)
* Fix bullet points not having leading margin on timeline items * Remove other usages of `SpannableString` constructor, use either `valueOf` to reuse the existing value or `SpannedString` instead if the spans don't have to change
This commit is contained in:
committed by
GitHub
parent
b1dd555baa
commit
977268b876
+2
-2
@@ -16,11 +16,11 @@ import io.element.android.libraries.core.extensions.orEmpty
|
||||
|
||||
@Stable
|
||||
class StableCharSequence(initialText: CharSequence = "") {
|
||||
private var value by mutableStateOf<SpannableString>(SpannableString(initialText))
|
||||
private var value by mutableStateOf<SpannableString>(SpannableString.valueOf(initialText))
|
||||
private var needsDisplaying by mutableStateOf(false)
|
||||
|
||||
fun update(newText: CharSequence?, needsDisplaying: Boolean) {
|
||||
value = SpannableString(newText.orEmpty())
|
||||
value = SpannableString.valueOf(newText.orEmpty())
|
||||
this.needsDisplaying = needsDisplaying
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -9,7 +9,6 @@ package io.element.android.libraries.textcomposer.model
|
||||
|
||||
import android.os.Parcelable
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -118,8 +117,7 @@ class MarkdownTextEditorState(
|
||||
}
|
||||
|
||||
fun getMentions(): List<IntentionalMention> {
|
||||
val text = SpannableString(text.value())
|
||||
val mentionSpans = text.getMentionSpans()
|
||||
val mentionSpans = text.value().getMentionSpans()
|
||||
return mentionSpans.mapNotNull { mentionSpan ->
|
||||
when (mentionSpan.type) {
|
||||
is MentionType.User -> IntentionalMention.User(mentionSpan.type.userId)
|
||||
|
||||
Reference in New Issue
Block a user