mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Display unread messages & missed calls counters on each account in side menu
This commit is contained in:
parent
565e957387
commit
cb20acfa52
7 changed files with 36 additions and 11 deletions
|
|
@ -57,6 +57,8 @@ class AccountModel @WorkerThread constructor(
|
|||
|
||||
val showTrust = MutableLiveData<Boolean>()
|
||||
|
||||
val notificationsCount = MutableLiveData<Int>()
|
||||
|
||||
private val accountListener = object : AccountListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onRegistrationStateChanged(
|
||||
|
|
@ -137,6 +139,7 @@ class AccountModel @WorkerThread constructor(
|
|||
}
|
||||
|
||||
isDefault.postValue(coreContext.core.defaultAccount == account)
|
||||
notificationsCount.postValue(account.unreadChatMessageCount + account.missedCallsCount)
|
||||
|
||||
val state = account.state
|
||||
registrationState.postValue(state)
|
||||
|
|
|
|||
5
app/src/main/res/drawable/shape_red_round.xml
Normal file
5
app/src/main/res/drawable/shape_red_round.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<size android:width="44dp" android:height="44dp" />
|
||||
<solid android:color="@color/red_danger_500"/>
|
||||
</shape>
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.missedCallsCount), default=`1`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
|
|
|
|||
|
|
@ -87,17 +87,18 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/missed_calls"
|
||||
android:id="@+id/calls_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(callsViewModel.callsCount), default=`1`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/calls_list"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/calls_list"
|
||||
app:layout_constraintEnd_toEndOf="@id/calls_list"/>
|
||||
|
||||
|
|
@ -207,8 +208,8 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/chat" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/in_call_extra_action_label_style"
|
||||
android:id="@+id/chat_label"
|
||||
style="@style/in_call_extra_action_label_style"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="15dp"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,21 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/missed_calls"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(model.notificationsCount), default=`1`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="8sp"
|
||||
android:visibility="@{model.notificationsCount > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"
|
||||
app:layout_constraintEnd_toEndOf="@id/avatar"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(viewModel.missedCallsCount), default=`1`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
|
|
|
|||
|
|
@ -87,17 +87,18 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/missed_calls"
|
||||
android:id="@+id/calls_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(callsViewModel.callsCount), default=`1`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
android:visibility="@{callsViewModel.callsCount > 1 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/calls_list"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_actions"
|
||||
app:layout_constraintStart_toStartOf="@id/calls_list"
|
||||
app:layout_constraintEnd_toEndOf="@id/calls_list"/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue