mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Reworked unread count indicators
This commit is contained in:
parent
adc7bfbe8d
commit
df9a346de5
12 changed files with 63 additions and 120 deletions
|
|
@ -260,8 +260,10 @@ class CoreContext
|
|||
if (core.defaultAccount == null && accounts.isNotEmpty()) {
|
||||
val firstAccount = accounts.firstOrNull()
|
||||
if (firstAccount != null) {
|
||||
Log.w("$TAG Default account is null but account list isn't empty, using account [${firstAccount.
|
||||
params.identityAddress?.asStringUriOnly()}] as default")
|
||||
val sipUri = firstAccount.params.identityAddress?.asStringUriOnly()
|
||||
Log.w(
|
||||
"$TAG Default account is null but account list isn't empty, using account [$sipUri] as default"
|
||||
)
|
||||
core.defaultAccount = firstAccount
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,15 +50,11 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/contacts" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/missed_calls"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:text="@{String.valueOf(viewModel.missedCallsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:visibility="@{viewModel.missedCallsCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/calls"
|
||||
app:layout_constraintEnd_toEndOf="@id/calls"/>
|
||||
|
|
@ -81,16 +77,11 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/calls" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessages), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessages), default=`100`}"
|
||||
android:visibility="@{viewModel.unreadMessages > 0 && !viewModel.hideConversations ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/conversations"
|
||||
app:layout_constraintEnd_toEndOf="@id/conversations"/>
|
||||
|
|
|
|||
|
|
@ -91,18 +91,13 @@
|
|||
app:tint="@color/in_call_button_tint_color" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/calls_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(callsViewModel.callsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/calls_list"
|
||||
|
|
@ -156,18 +151,13 @@
|
|||
app:layout_constraintBottom_toBottomOf="@id/chat"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessagesCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{viewModel.unreadMessagesCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/chat"
|
||||
|
|
|
|||
|
|
@ -87,18 +87,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/main_actions" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/calls_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(callsViewModel.callsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/calls_list"
|
||||
|
|
@ -138,18 +133,13 @@
|
|||
app:layout_constraintEnd_toEndOf="@id/chat_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessagesCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{viewModel.unreadMessagesCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/chat"
|
||||
|
|
|
|||
|
|
@ -110,17 +110,12 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/notifications_count"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/notifications_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(model.notificationsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{model.notificationsCount > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
|||
|
|
@ -56,18 +56,13 @@
|
|||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/missed_calls"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.missedCallsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{viewModel.missedCallsCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/calls"
|
||||
app:layout_constraintStart_toStartOf="@id/calls"
|
||||
|
|
@ -94,18 +89,13 @@
|
|||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessages), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{viewModel.unreadMessages > 0 && !viewModel.hideConversations ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/conversations"
|
||||
app:layout_constraintStart_toStartOf="@id/conversations"
|
||||
|
|
|
|||
|
|
@ -91,18 +91,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/main_actions" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/calls_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(callsViewModel.callsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/calls_list"
|
||||
|
|
@ -156,18 +151,13 @@
|
|||
app:layout_constraintBottom_toBottomOf="@id/chat"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessagesCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{viewModel.unreadMessagesCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/transfer_label"
|
||||
app:layout_constraintStart_toStartOf="@id/chat"
|
||||
|
|
|
|||
|
|
@ -87,18 +87,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/main_actions" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/calls_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(callsViewModel.callsCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/calls_list"
|
||||
|
|
@ -138,18 +133,13 @@
|
|||
app:layout_constraintEnd_toEndOf="@id/screen_sharing"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessagesCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{viewModel.unreadMessagesCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/screen_sharing_label"
|
||||
app:layout_constraintStart_toStartOf="@id/chat"
|
||||
|
|
|
|||
|
|
@ -348,17 +348,13 @@
|
|||
app:layout_constraintBottom_toTopOf="@id/send_area" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/unread_messages"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginTop="-13dp"
|
||||
android:layout_marginStart="-11dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.unreadMessagesCount), default=`1`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:visibility="@{viewModel.isUserScrollingUp && viewModel.unreadMessagesCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/scroll_to_bottom"
|
||||
app:layout_constraintStart_toEndOf="@id/scroll_to_bottom"/>
|
||||
|
|
|
|||
|
|
@ -144,16 +144,12 @@
|
|||
app:layout_constraintBottom_toBottomOf="@id/title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
style="@style/unread_count_text_style"
|
||||
android:id="@+id/notifications_count"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="@dimen/unread_count_indicator_size"
|
||||
android:layout_height="@dimen/unread_count_indicator_size"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(model.unreadMessageCount), default=`99`}"
|
||||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="11sp"
|
||||
android:visibility="@{model.unreadMessageCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/date_time"
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@
|
|||
<dimen name="chat_bubble_start_margin_when_avatar_displayed">10dp</dimen>
|
||||
<dimen name="chat_conversation_header_avatar_start_margin_if_back_button">5dp</dimen>
|
||||
<dimen name="chat_conversation_header_avatar_start_margin_if_no_back_button">15dp</dimen>
|
||||
<dimen name="unread_count_indicator_size">24dp</dimen>
|
||||
|
||||
<dimen name="chat_room_emoji_picker_height">300dp</dimen>
|
||||
<dimen name="chat_room_participants_list_max_height">300dp</dimen>
|
||||
|
|
|
|||
|
|
@ -187,4 +187,16 @@
|
|||
<item name="android:adjustViewBounds">true</item>
|
||||
<item name="android:scaleType">centerCrop</item>
|
||||
</style>
|
||||
<style name="unread_count_text_style">
|
||||
<item name="android:fontFamily">@font/noto_sans</item>
|
||||
<item name="android:textColor">?attr/color_on_main</item>
|
||||
<item name="android:textColorHint">?attr/color_hint_text</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:background">@drawable/shape_red_round</item>
|
||||
<item name="android:textSize">13sp</item>
|
||||
<item name="android:paddingBottom">2dp</item>
|
||||
<item name="android:autoSizeTextType">uniform</item>
|
||||
<item name="android:autoSizeMinTextSize">8sp</item>
|
||||
<item name="android:autoSizeStepGranularity">1sp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue