From 46aebb168ce84458a3ded8886cdf4e3b8de79625 Mon Sep 17 00:00:00 2001 From: Ian Macdonald Date: Tue, 18 Jan 2022 12:32:20 +0100 Subject: [PATCH] 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. --- .../securesms/conversation/v2/ConversationActivityV2.kt | 4 ++-- .../org/thoughtcrime/securesms/home/ConversationView.kt | 6 +++--- app/src/main/res/drawable/rounded_rectangle.xml | 7 +++++++ app/src/main/res/layout/activity_conversation_v2.xml | 9 ++++++--- app/src/main/res/layout/view_conversation.xml | 9 ++++++--- 5 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/drawable/rounded_rectangle.xml diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 09a9881a9..916f7ba00 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -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) diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt index 0cd1ad40b..3e4a71200 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt @@ -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 -} \ No newline at end of file +} diff --git a/app/src/main/res/drawable/rounded_rectangle.xml b/app/src/main/res/drawable/rounded_rectangle.xml new file mode 100644 index 000000000..4901429e3 --- /dev/null +++ b/app/src/main/res/drawable/rounded_rectangle.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/app/src/main/res/layout/activity_conversation_v2.xml b/app/src/main/res/layout/activity_conversation_v2.xml index 61e1680ef..3309a648f 100644 --- a/app/src/main/res/layout/activity_conversation_v2.xml +++ b/app/src/main/res/layout/activity_conversation_v2.xml @@ -115,11 +115,14 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/view_conversation.xml b/app/src/main/res/layout/view_conversation.xml index 2df317c30..0d63ea3a6 100644 --- a/app/src/main/res/layout/view_conversation.xml +++ b/app/src/main/res/layout/view_conversation.xml @@ -63,10 +63,13 @@ - \ No newline at end of file +