mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Added MWI urgent messages count to drawer
This commit is contained in:
parent
bf64b496c9
commit
6cfec04424
3 changed files with 37 additions and 5 deletions
|
|
@ -61,6 +61,8 @@ class AccountModel @WorkerThread constructor(
|
|||
|
||||
val notificationsCount = MutableLiveData<Int>()
|
||||
|
||||
val voicemailCount = MutableLiveData<Int>()
|
||||
|
||||
private val accountListener = object : AccountListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onRegistrationStateChanged(
|
||||
|
|
@ -90,6 +92,7 @@ class AccountModel @WorkerThread constructor(
|
|||
Log.i(
|
||||
"$TAG [MWI] [$context]: new [$nbNew] urgent ($nbNewUrgent), old [$nbOld] urgent ($nbOldUrgent)"
|
||||
)
|
||||
voicemailCount.postValue(nbNew)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -115,6 +118,7 @@ class AccountModel @WorkerThread constructor(
|
|||
coreContext.core.addListener(coreListener)
|
||||
|
||||
presenceStatus.postValue(ConsolidatedPresence.Offline)
|
||||
voicemailCount.postValue(0)
|
||||
|
||||
update()
|
||||
}
|
||||
|
|
|
|||
9
app/src/main/res/drawable/voicemail.xml
Normal file
9
app/src/main/res/drawable/voicemail.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="256"
|
||||
android:viewportHeight="256">
|
||||
<path
|
||||
android:pathData="M200,72a56,56 0,0 0,-39.14 96L95.14,168A56,56 0,1 0,56 184L200,184a56,56 0,0 0,0 -112ZM16,128a40,40 0,1 1,40 40A40,40 0,0 1,16 128ZM200,168a40,40 0,1 1,40 -40A40,40 0,0 1,200 168Z"
|
||||
android:fillColor="#4e6074"/>
|
||||
</vector>
|
||||
|
|
@ -19,11 +19,11 @@
|
|||
android:background="@{model.isDefault ? @color/main2_100 : @color/main2_000, default=@color/main2_100}">
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/left_barrier"
|
||||
android:id="@+id/end_barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="right"
|
||||
app:constraint_referenced_ids="name, register_status" />
|
||||
app:barrierDirection="start"
|
||||
app:constraint_referenced_ids="voicemail_count, notifications_count, menu" />
|
||||
|
||||
<include
|
||||
android:id="@+id/avatar"
|
||||
|
|
@ -50,8 +50,10 @@
|
|||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_700"
|
||||
android:layout_marginStart="10dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintEnd_toStartOf="@id/menu"
|
||||
app:layout_constraintEnd_toStartOf="@id/end_barrier"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/register_status"/>
|
||||
|
||||
|
|
@ -77,6 +79,23 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintBottom_toTopOf="@id/separator"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/voicemail_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@{String.valueOf(model.voicemailCount), default=`1`}"
|
||||
android:textColor="?attr/color_danger_500"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{model.voicemailCount > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:drawableBottom="@drawable/voicemail"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/notifications_count"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/notifications_count"
|
||||
|
|
@ -89,7 +108,7 @@
|
|||
android:textColor="?attr/color_on_main"
|
||||
android:textSize="13sp"
|
||||
android:paddingBottom="2dp"
|
||||
android:visibility="@{model.notificationsCount > 0 ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{model.notificationsCount > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/menu"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue