mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-21 11:18:26 +00:00
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:
parent
bd5a324ad8
commit
46aebb168c
@ -756,9 +756,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateUnreadCountIndicator() {
|
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
|
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.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize)
|
||||||
binding.unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
|
binding.unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
|
||||||
binding.unreadCountIndicator.isVisible = (unreadCount != 0)
|
binding.unreadCountIndicator.isVisible = (unreadCount != 0)
|
||||||
|
@ -61,10 +61,10 @@ class ConversationView : LinearLayout {
|
|||||||
val formattedUnreadCount = if (thread.isRead) {
|
val formattedUnreadCount = if (thread.isRead) {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
if (unreadCount < 100) unreadCount.toString() else "99+"
|
if (unreadCount < 10000) unreadCount.toString() else "9999+"
|
||||||
}
|
}
|
||||||
binding.unreadCountTextView.text = formattedUnreadCount
|
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.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize)
|
||||||
binding.unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
|
binding.unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
|
||||||
binding.unreadCountIndicator.isVisible = (unreadCount != 0 && !thread.isRead)
|
binding.unreadCountIndicator.isVisible = (unreadCount != 0 && !thread.isRead)
|
||||||
@ -120,4 +120,4 @@ class ConversationView : LinearLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
7
app/src/main/res/drawable/rounded_rectangle.xml
Normal file
7
app/src/main/res/drawable/rounded_rectangle.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
@ -115,11 +115,14 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/unreadCountIndicator"
|
android:id="@+id/unreadCountIndicator"
|
||||||
android:layout_width="20dp"
|
android:layout_width="wrap_content"
|
||||||
|
android:maxWidth="40dp"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:background="@drawable/circle_tintable"
|
android:background="@drawable/rounded_rectangle"
|
||||||
android:backgroundTint="@color/conversation_unread_count_indicator_background">
|
android:backgroundTint="@color/conversation_unread_count_indicator_background">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -165,4 +168,4 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -63,10 +63,13 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/unreadCountIndicator"
|
android:id="@+id/unreadCountIndicator"
|
||||||
android:layout_width="20dp"
|
android:layout_width="wrap_content"
|
||||||
|
android:maxWidth="40dp"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:background="@drawable/circle_tintable"
|
android:background="@drawable/rounded_rectangle"
|
||||||
android:backgroundTint="@color/conversation_unread_count_indicator_background">
|
android:backgroundTint="@color/conversation_unread_count_indicator_background">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -148,4 +151,4 @@
|
|||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user