diff options
| author | Selim Cinek <cinek@google.com> | 2020-04-06 19:20:47 -0700 |
|---|---|---|
| committer | Selim Cinek <cinek@google.com> | 2020-04-06 20:16:27 -0700 |
| commit | 94d0be89f008ebe82d59839b8a3f7c7c43b333c1 (patch) | |
| tree | ae9024957807d109eee99d42e4bd2f1442500d52 /core/java | |
| parent | a959fe44a00b15e97ef49cbe5bcf72a78c658c4b (diff) | |
Fixed an issue where the unread count would disappear too fast
Especially with images this was leading to really bad transitions
since the image would pop over immediately.
We now update the counter once the expansion has finished
Fixes: 153392205
Test: add conversations with messages with unread count and image, click on it.
Change-Id: I2ad2ec6a989a21154e3edbf09aabc6d17ea75bd7
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/widget/ConversationLayout.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/core/java/com/android/internal/widget/ConversationLayout.java b/core/java/com/android/internal/widget/ConversationLayout.java index 5e72fa07242e..26684201019c 100644 --- a/core/java/com/android/internal/widget/ConversationLayout.java +++ b/core/java/com/android/internal/widget/ConversationLayout.java @@ -386,14 +386,17 @@ public class ConversationLayout extends FrameLayout /** @hide */ public void setUnreadCount(int unreadCount) { - mUnreadBadge.setVisibility(mIsCollapsed && unreadCount > 1 ? VISIBLE : GONE); - CharSequence text = unreadCount >= 100 - ? getResources().getString(R.string.unread_convo_overflow, 99) - : String.format(Locale.getDefault(), "%d", unreadCount); - mUnreadBadge.setText(text); - mUnreadBadge.setBackgroundTintList(ColorStateList.valueOf(mLayoutColor)); - boolean needDarkText = ColorUtils.calculateLuminance(mLayoutColor) > 0.5f; - mUnreadBadge.setTextColor(needDarkText ? Color.BLACK : Color.WHITE); + boolean visible = mIsCollapsed && unreadCount > 1; + mUnreadBadge.setVisibility(visible ? VISIBLE : GONE); + if (visible) { + CharSequence text = unreadCount >= 100 + ? getResources().getString(R.string.unread_convo_overflow, 99) + : String.format(Locale.getDefault(), "%d", unreadCount); + mUnreadBadge.setText(text); + mUnreadBadge.setBackgroundTintList(ColorStateList.valueOf(mLayoutColor)); + boolean needDarkText = ColorUtils.calculateLuminance(mLayoutColor) > 0.5f; + mUnreadBadge.setTextColor(needDarkText ? Color.BLACK : Color.WHITE); + } } private void addRemoteInputHistoryToMessages( |
