mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Show label when devices list in account profile is empty
This commit is contained in:
parent
a9736df3eb
commit
5cee11c779
4 changed files with 25 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ package org.linphone.ui.main.settings.viewmodel
|
|||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import java.io.File
|
||||
|
|
@ -79,6 +80,8 @@ class AccountProfileViewModel
|
|||
|
||||
val isOnDefaultDomain = MutableLiveData<Boolean>()
|
||||
|
||||
val emptyDevices = MediatorLiveData<Boolean>()
|
||||
|
||||
val devicesFetchInProgress = MutableLiveData<Boolean>()
|
||||
|
||||
val hideAccountSettings = MutableLiveData<Boolean>()
|
||||
|
|
@ -176,6 +179,11 @@ class AccountProfileViewModel
|
|||
devicesFetchInProgress.value = true
|
||||
isOnDefaultDomain.value = false
|
||||
|
||||
emptyDevices.value = true
|
||||
emptyDevices.addSource(devices) { list ->
|
||||
emptyDevices.value = list.orEmpty().isEmpty()
|
||||
}
|
||||
|
||||
coreContext.postOnCoreThread {
|
||||
hideAccountSettings.postValue(corePreferences.hideAccountSettings)
|
||||
dialPlansLabelList.add("") // To allow removing selected dial plan
|
||||
|
|
|
|||
|
|
@ -459,6 +459,21 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/devices" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/empty_devices_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/manage_account_empty_devices_label"
|
||||
android:visibility="@{viewModel.isOnDefaultDomain && viewModel.expandDevices && !viewModel.devicesFetchInProgress && viewModel.emptyDevices ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toTopOf="@id/devices_list"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/devices_list"/>
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/devices_fetch_progress"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -467,7 +482,6 @@
|
|||
app:indicatorColor="?attr/color_main1_500"
|
||||
android:indeterminate="true"
|
||||
android:visibility="@{viewModel.devicesFetchInProgress && viewModel.expandDevices ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintTop_toTopOf="@id/devices_list"
|
||||
app:layout_constraintStart_toStartOf="@id/devices_list"
|
||||
app:layout_constraintEnd_toEndOf="@id/devices_list"
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@
|
|||
<string name="manage_account_title">Mon compte</string>
|
||||
<string name="manage_account_details_title">Détails</string>
|
||||
<string name="manage_account_devices_title">Appareils</string>
|
||||
<string name="manage_account_empty_devices_label">Aucun appareil…</string>
|
||||
<string name="manage_account_add_picture">Ajouter une image</string>
|
||||
<string name="manage_account_edit_picture">Modifier </string>
|
||||
<string name="manage_account_remove_picture">Suprimmer</string>
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@
|
|||
<string name="manage_account_title">Manage account</string>
|
||||
<string name="manage_account_details_title">Details</string>
|
||||
<string name="manage_account_devices_title">Devices</string>
|
||||
<string name="manage_account_empty_devices_label">No device found…</string>
|
||||
<string name="manage_account_add_picture">Add a picture</string>
|
||||
<string name="manage_account_edit_picture">Edit picture</string>
|
||||
<string name="manage_account_remove_picture">Remove picture</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue