mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Fix chevron appearing below the recipient name.
This commit is contained in:
committed by
Michelle Tang
parent
95149764eb
commit
6fbf4d4ae6
@@ -2,23 +2,16 @@ package org.thoughtcrime.securesms.components.settings.conversation.preferences
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.Context
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.settings.PreferenceModel
|
||||
import org.thoughtcrime.securesms.fonts.SignalSymbols
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.ContextUtil
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil
|
||||
import org.thoughtcrime.securesms.util.SpanUtil
|
||||
import org.thoughtcrime.securesms.util.ViewUtil
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.LayoutFactory
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingViewHolder
|
||||
import org.signal.core.ui.R as CoreUiR
|
||||
|
||||
/**
|
||||
* Renders name, description, about, etc. for a given group or recipient.
|
||||
@@ -44,54 +37,7 @@ object BioTextPreference {
|
||||
) : BioTextPreferenceModel<RecipientModel>() {
|
||||
|
||||
override fun getHeadlineText(context: Context): CharSequence {
|
||||
val name = if (recipient.isSelf) {
|
||||
context.getString(R.string.note_to_self)
|
||||
} else {
|
||||
recipient.getDisplayName(context)
|
||||
}
|
||||
|
||||
if (!recipient.showVerified && !recipient.isIndividual) {
|
||||
return name
|
||||
}
|
||||
|
||||
return SpannableStringBuilder(name).apply {
|
||||
if (recipient.showVerified) {
|
||||
SpanUtil.appendSpacer(this, 8)
|
||||
SpanUtil.appendCenteredImageSpanWithoutSpace(this, ContextUtil.requireDrawable(context, R.drawable.ic_official_28), 28, 28)
|
||||
} else if (recipient.isSystemContact) {
|
||||
val systemContactGlyph = SignalSymbols.getSpannedString(
|
||||
context,
|
||||
SignalSymbols.Weight.BOLD,
|
||||
SignalSymbols.Glyph.PERSON_CIRCLE
|
||||
).let {
|
||||
SpanUtil.ofSize(it, 20)
|
||||
}
|
||||
|
||||
append(" ")
|
||||
append(systemContactGlyph)
|
||||
}
|
||||
|
||||
if (recipient.isIndividual && !recipient.isSelf) {
|
||||
val isLtr = ViewUtil.isLtr(context)
|
||||
val chevronGlyph = SignalSymbols.getSpannedString(
|
||||
context,
|
||||
SignalSymbols.Weight.BOLD,
|
||||
if (isLtr) SignalSymbols.Glyph.CHEVRON_RIGHT else SignalSymbols.Glyph.CHEVRON_LEFT
|
||||
).let {
|
||||
SpanUtil.ofSize(it, 24)
|
||||
}.let {
|
||||
SpanUtil.color(ContextCompat.getColor(context, CoreUiR.color.signal_colorOutline), it)
|
||||
}
|
||||
|
||||
if (isLtr) {
|
||||
append(" ")
|
||||
append(chevronGlyph)
|
||||
} else {
|
||||
insert(0, " ")
|
||||
insert(0, chevronGlyph)
|
||||
}
|
||||
}
|
||||
}
|
||||
return recipient.getDisplayNameForHeadline(context)
|
||||
}
|
||||
|
||||
override fun getSubhead1Text(context: Context): String? {
|
||||
|
||||
Reference in New Issue
Block a user