Add chevron to conversation heading.
This commit is contained in:
parent
133b7ef3f1
commit
544cc06f13
6 changed files with 31 additions and 11 deletions
|
@ -67,7 +67,8 @@ class InternalConversationTestFragment : Fragment(R.layout.conversation_test_fra
|
||||||
hasWallpaper = springboardViewModel.hasWallpaper.value,
|
hasWallpaper = springboardViewModel.hasWallpaper.value,
|
||||||
colorizer = Colorizer(),
|
colorizer = Colorizer(),
|
||||||
startExpirationTimeout = {},
|
startExpirationTimeout = {},
|
||||||
chatColorsDataProvider = { ChatColorsDrawable.ChatColorsData(null, null) }
|
chatColorsDataProvider = { ChatColorsDrawable.ChatColorsData(null, null) },
|
||||||
|
displayDialogFragment = {}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (springboardViewModel.hasWallpaper.value) {
|
if (springboardViewModel.hasWallpaper.value) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
||||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||||
import org.thoughtcrime.securesms.databinding.ConversationHeaderViewBinding;
|
import org.thoughtcrime.securesms.databinding.ConversationHeaderViewBinding;
|
||||||
|
import org.thoughtcrime.securesms.fonts.SignalSymbols;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.util.ContextUtil;
|
import org.thoughtcrime.securesms.util.ContextUtil;
|
||||||
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
|
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
|
||||||
|
@ -75,11 +76,22 @@ public class ConversationHeaderView extends ConstraintLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String setTitle(@NonNull Recipient recipient) {
|
public String setTitle(@NonNull Recipient recipient, @NonNull Runnable onTitleClicked) {
|
||||||
SpannableStringBuilder title = new SpannableStringBuilder(recipient.isSelf() ? getContext().getString(R.string.note_to_self) : recipient.getDisplayName(getContext()));
|
SpannableStringBuilder title = new SpannableStringBuilder(recipient.isSelf() ? getContext().getString(R.string.note_to_self) : recipient.getDisplayName(getContext()));
|
||||||
if (recipient.showVerified()) {
|
if (recipient.showVerified()) {
|
||||||
SpanUtil.appendCenteredImageSpan(title, ContextUtil.requireDrawable(getContext(), R.drawable.ic_official_28), 28, 28);
|
SpanUtil.appendCenteredImageSpan(title, ContextUtil.requireDrawable(getContext(), R.drawable.ic_official_28), 28, 28);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recipient.isIndividual() && !recipient.isSelf()) {
|
||||||
|
CharSequence chevronRight = SignalSymbols.getSpannedString(getContext(), SignalSymbols.Weight.BOLD, SignalSymbols.Glyph.CHEVRON_RIGHT);
|
||||||
|
title.append(" ");
|
||||||
|
title.append(SpanUtil.ofSize(chevronRight, 24));
|
||||||
|
|
||||||
|
binding.messageRequestTitle.setOnClickListener(v -> onTitleClicked.run());
|
||||||
|
} else {
|
||||||
|
binding.messageRequestTitle.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
binding.messageRequestTitle.setText(title);
|
binding.messageRequestTitle.setText(title);
|
||||||
return title.toString();
|
return title.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.media3.common.MediaItem
|
import androidx.media3.common.MediaItem
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -52,6 +53,7 @@ import org.thoughtcrime.securesms.groups.v2.GroupDescriptionUtil
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
|
import org.thoughtcrime.securesms.recipients.ui.about.AboutSheet
|
||||||
import org.thoughtcrime.securesms.util.CachedInflater
|
import org.thoughtcrime.securesms.util.CachedInflater
|
||||||
import org.thoughtcrime.securesms.util.Projection
|
import org.thoughtcrime.securesms.util.Projection
|
||||||
import org.thoughtcrime.securesms.util.ProjectionList
|
import org.thoughtcrime.securesms.util.ProjectionList
|
||||||
|
@ -67,7 +69,8 @@ class ConversationAdapterV2(
|
||||||
private var hasWallpaper: Boolean,
|
private var hasWallpaper: Boolean,
|
||||||
private val colorizer: Colorizer,
|
private val colorizer: Colorizer,
|
||||||
private val startExpirationTimeout: (MessageRecord) -> Unit,
|
private val startExpirationTimeout: (MessageRecord) -> Unit,
|
||||||
private val chatColorsDataProvider: () -> ChatColorsDrawable.ChatColorsData
|
private val chatColorsDataProvider: () -> ChatColorsDrawable.ChatColorsData,
|
||||||
|
private val displayDialogFragment: (DialogFragment) -> Unit
|
||||||
) : PagingMappingAdapter<ConversationElementKey>(), ConversationAdapterBridge, V2ConversationContext {
|
) : PagingMappingAdapter<ConversationElementKey>(), ConversationAdapterBridge, V2ConversationContext {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -570,7 +573,9 @@ class ConversationAdapterV2(
|
||||||
|
|
||||||
conversationBanner.setAvatar(requestManager, recipient)
|
conversationBanner.setAvatar(requestManager, recipient)
|
||||||
conversationBanner.showBackgroundBubble(recipient.hasWallpaper())
|
conversationBanner.showBackgroundBubble(recipient.hasWallpaper())
|
||||||
val title: String = conversationBanner.setTitle(recipient)
|
val title: String = conversationBanner.setTitle(recipient) {
|
||||||
|
displayDialogFragment(AboutSheet.create(recipient))
|
||||||
|
}
|
||||||
conversationBanner.setAbout(recipient)
|
conversationBanner.setAbout(recipient)
|
||||||
|
|
||||||
if (recipient.isGroup) {
|
if (recipient.isGroup) {
|
||||||
|
|
|
@ -1536,7 +1536,8 @@ class ConversationFragment :
|
||||||
hasWallpaper = args.wallpaper != null,
|
hasWallpaper = args.wallpaper != null,
|
||||||
colorizer = colorizer,
|
colorizer = colorizer,
|
||||||
startExpirationTimeout = viewModel::startExpirationTimeout,
|
startExpirationTimeout = viewModel::startExpirationTimeout,
|
||||||
chatColorsDataProvider = viewModel::chatColorsSnapshot
|
chatColorsDataProvider = viewModel::chatColorsSnapshot,
|
||||||
|
displayDialogFragment = { it.show(childFragmentManager, null) }
|
||||||
)
|
)
|
||||||
|
|
||||||
typingIndicatorAdapter = ConversationTypingIndicatorAdapter(Glide.with(this))
|
typingIndicatorAdapter = ConversationTypingIndicatorAdapter(Glide.with(this))
|
||||||
|
|
|
@ -27,6 +27,7 @@ object SignalSymbols {
|
||||||
|
|
||||||
private val cache = mutableMapOf<Weight, Typeface>()
|
private val cache = mutableMapOf<Weight, Typeface>()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun getSpannedString(
|
fun getSpannedString(
|
||||||
context: Context,
|
context: Context,
|
||||||
weight: Weight,
|
weight: Weight,
|
||||||
|
|
|
@ -196,18 +196,18 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||||
SpanUtil.appendSpacer(nameBuilder, 8);
|
SpanUtil.appendSpacer(nameBuilder, 8);
|
||||||
SpanUtil.appendCenteredImageSpanWithoutSpace(nameBuilder, ContextUtil.requireDrawable(requireContext(), R.drawable.ic_official_28), 28, 28);
|
SpanUtil.appendCenteredImageSpanWithoutSpace(nameBuilder, ContextUtil.requireDrawable(requireContext(), R.drawable.ic_official_28), 28, 28);
|
||||||
} else if (recipient.isSystemContact()) {
|
} else if (recipient.isSystemContact()) {
|
||||||
CharSequence systemContactGlyph = SignalSymbols.INSTANCE.getSpannedString(requireContext(),
|
CharSequence systemContactGlyph = SignalSymbols.getSpannedString(requireContext(),
|
||||||
SignalSymbols.Weight.BOLD,
|
SignalSymbols.Weight.BOLD,
|
||||||
SignalSymbols.Glyph.PERSON_CIRCLE);
|
SignalSymbols.Glyph.PERSON_CIRCLE);
|
||||||
|
|
||||||
nameBuilder.append(" ");
|
nameBuilder.append(" ");
|
||||||
nameBuilder.append(SpanUtil.ofSize(systemContactGlyph, 20));
|
nameBuilder.append(SpanUtil.ofSize(systemContactGlyph, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipient.isSelf() && recipient.isIndividual()) {
|
if (!recipient.isSelf() && recipient.isIndividual()) {
|
||||||
CharSequence chevronGlyph = SignalSymbols.INSTANCE.getSpannedString(requireContext(),
|
CharSequence chevronGlyph = SignalSymbols.getSpannedString(requireContext(),
|
||||||
SignalSymbols.Weight.BOLD,
|
SignalSymbols.Weight.BOLD,
|
||||||
SignalSymbols.Glyph.CHEVRON_RIGHT);
|
SignalSymbols.Glyph.CHEVRON_RIGHT);
|
||||||
|
|
||||||
nameBuilder.append(" ");
|
nameBuilder.append(" ");
|
||||||
nameBuilder.append(SpanUtil.color(ContextCompat.getColor(requireContext(), R.color.signal_colorOutline),
|
nameBuilder.append(SpanUtil.color(ContextCompat.getColor(requireContext(), R.color.signal_colorOutline),
|
||||||
|
|
Loading…
Add table
Reference in a new issue