Make the unread message count 4 digits instead of 2. (#827)

* Make the unread message count 4 digits instead of 2.

99+ unread messages can be reached within an hour in some busy open
groups. 4 digits allow for much more accurate reporting.

* Improve appearance of unread counter by using rounded rectangle.
This commit is contained in:
Ian Macdonald
2022-01-18 12:32:20 +01:00
committed by GitHub
parent bd5a324ad8
commit 46aebb168c
5 changed files with 24 additions and 11 deletions

View File

@@ -756,9 +756,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
}
private fun updateUnreadCountIndicator() {
val formattedUnreadCount = if (unreadCount < 100) unreadCount.toString() else "99+"
val formattedUnreadCount = if (unreadCount < 10000) unreadCount.toString() else "9999+"
binding.unreadCountTextView.text = formattedUnreadCount
val textSize = if (unreadCount < 100) 12.0f else 9.0f
val textSize = if (unreadCount < 10000) 12.0f else 9.0f
binding.unreadCountTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize)
binding.unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
binding.unreadCountIndicator.isVisible = (unreadCount != 0)

View File

@@ -61,10 +61,10 @@ class ConversationView : LinearLayout {
val formattedUnreadCount = if (thread.isRead) {
null
} else {
if (unreadCount < 100) unreadCount.toString() else "99+"
if (unreadCount < 10000) unreadCount.toString() else "9999+"
}
binding.unreadCountTextView.text = formattedUnreadCount
val textSize = if (unreadCount < 100) 12.0f else 9.0f
val textSize = if (unreadCount < 10000) 12.0f else 9.0f
binding.unreadCountTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize)
binding.unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
binding.unreadCountIndicator.isVisible = (unreadCount != 0 && !thread.isRead)
@@ -120,4 +120,4 @@ class ConversationView : LinearLayout {
}
}
// endregion
}
}