mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 02:08:40 +00:00
Fixes on Chat list.
This commit is contained in:
committed by
Greyson Parrelli
parent
a805f9b6b4
commit
076facbdc2
@@ -172,9 +172,9 @@ public final class ConversationListItem extends ConstraintLayout
|
||||
if (highlightSubstring != null) {
|
||||
String name = recipient.get().isSelf() ? getContext().getString(R.string.note_to_self) : recipient.get().getDisplayName(getContext());
|
||||
|
||||
this.fromView.setText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getBoldSpan, name, highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
this.fromView.setText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getMediumBoldSpan, name, highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
} else {
|
||||
this.fromView.setText(recipient.get(), thread.isRead());
|
||||
this.fromView.setText(recipient.get(), false);
|
||||
}
|
||||
|
||||
this.typingThreads = typingThreads;
|
||||
@@ -218,7 +218,7 @@ public final class ConversationListItem extends ConstraintLayout
|
||||
this.locale = locale;
|
||||
this.highlightSubstring = highlightSubstring;
|
||||
|
||||
fromView.setText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getBoldSpan, new SpannableString(contact.getDisplayName(getContext())), highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
fromView.setText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getMediumBoldSpan, new SpannableString(contact.getDisplayName(getContext())), highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
setSubjectViewText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getBoldSpan, contact.getE164().or(""), highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
dateView.setText("");
|
||||
archivedView.setVisibility(GONE);
|
||||
@@ -246,7 +246,7 @@ public final class ConversationListItem extends ConstraintLayout
|
||||
this.locale = locale;
|
||||
this.highlightSubstring = highlightSubstring;
|
||||
|
||||
fromView.setText(recipient.get(), true);
|
||||
fromView.setText(recipient.get(), false);
|
||||
setSubjectViewText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getBoldSpan, messageResult.getBodySnippet(), highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
dateView.setText(DateUtils.getBriefRelativeTimeSpanString(getContext(), locale, messageResult.getReceivedTimestampMs()));
|
||||
archivedView.setVisibility(GONE);
|
||||
@@ -403,12 +403,11 @@ public final class ConversationListItem extends ConstraintLayout
|
||||
}
|
||||
|
||||
private void setUnreadIndicator(ThreadRecord thread) {
|
||||
if ((thread.isOutgoing() && !thread.isForcedUnread()) || thread.isRead() || unreadCount == 0) {
|
||||
if ((thread.isOutgoing() && !thread.isForcedUnread()) || thread.isRead()) {
|
||||
unreadIndicator.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
String count = unreadCount > 100 ? String.valueOf(unreadCount) : "+99";
|
||||
unreadIndicator.setText(unreadCount > 0 ? String.valueOf(unreadCount) : " ");
|
||||
unreadIndicator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -422,9 +421,9 @@ public final class ConversationListItem extends ConstraintLayout
|
||||
|
||||
if (highlightSubstring != null) {
|
||||
String name = recipient.isSelf() ? getContext().getString(R.string.note_to_self) : recipient.getDisplayName(getContext());
|
||||
fromView.setText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getBoldSpan, new SpannableString(name), highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
fromView.setText(SearchUtil.getHighlightedSpan(locale, SpanUtil::getMediumBoldSpan, new SpannableString(name), highlightSubstring, SearchUtil.MATCH_ALL));
|
||||
} else {
|
||||
fromView.setText(recipient, unreadCount == 0);
|
||||
fromView.setText(recipient, false);
|
||||
}
|
||||
contactPhotoImage.setAvatar(glideRequests, recipient, !batchMode);
|
||||
setRippleColor(recipient);
|
||||
|
||||
@@ -37,8 +37,9 @@ public final class SpanUtil {
|
||||
|
||||
public static final String SPAN_PLACE_HOLDER = "<<<SPAN>>>";
|
||||
|
||||
private final static Typeface BOLD_TYPEFACE = Typeface.create("sans-serif-medium", Typeface.NORMAL);
|
||||
private final static Typeface LIGHT_TYPEFACE = Typeface.create("sans-serif", Typeface.NORMAL);
|
||||
private final static Typeface MEDIUM_BOLD_TYPEFACE = Typeface.create("sans-serif-medium", Typeface.BOLD);
|
||||
private final static Typeface BOLD_TYPEFACE = Typeface.create("sans-serif-medium", Typeface.NORMAL);
|
||||
private final static Typeface LIGHT_TYPEFACE = Typeface.create("sans-serif", Typeface.NORMAL);
|
||||
|
||||
public static CharSequence italic(CharSequence sequence) {
|
||||
return italic(sequence, sequence.length());
|
||||
@@ -212,8 +213,16 @@ public final class SpanUtil {
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static CharacterStyle getMediumBoldSpan() {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return new TypefaceSpan(MEDIUM_BOLD_TYPEFACE);
|
||||
} else {
|
||||
return new StyleSpan(Typeface.BOLD);
|
||||
}
|
||||
}
|
||||
|
||||
public static CharacterStyle getBoldSpan() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return new TypefaceSpan(BOLD_TYPEFACE);
|
||||
} else {
|
||||
return new StyleSpan(Typeface.BOLD);
|
||||
@@ -221,7 +230,7 @@ public final class SpanUtil {
|
||||
}
|
||||
|
||||
public static CharacterStyle getNormalSpan() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return new TypefaceSpan(LIGHT_TYPEFACE);
|
||||
} else {
|
||||
return new StyleSpan(Typeface.NORMAL);
|
||||
|
||||
Reference in New Issue
Block a user