Added undertermined progress bar while fetching devices list in account profile

This commit is contained in:
Sylvain Berfini 2024-08-22 11:03:04 +02:00
parent 7c3bed7dd4
commit c40c15b66f
2 changed files with 19 additions and 0 deletions

View file

@ -72,6 +72,8 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
val devicesAvailable = MutableLiveData<Boolean>()
val devicesFetchInProgress = MutableLiveData<Boolean>()
val hideAccountSettings = MutableLiveData<Boolean>()
val deviceId = MutableLiveData<String>()
@ -117,6 +119,7 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
)
}
devices.postValue(devicesList)
devicesFetchInProgress.postValue(false)
}
@WorkerThread
@ -140,6 +143,7 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
)
)
)
devicesFetchInProgress.postValue(false)
}
else -> {}
}
@ -151,6 +155,7 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
expandDetails.value = true
expandDevices.value = false
showDeviceId.value = false
devicesFetchInProgress.value = true
coreContext.postOnCoreThread {
hideAccountSettings.postValue(corePreferences.hideAccountSettings)

View file

@ -457,6 +457,20 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/devices" />
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/devices_fetch_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:indicatorColor="?attr/color_main1_500"
android:indeterminate="true"
android:visibility="@{viewModel.devicesFetchInProgress &amp;&amp; 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"
app:layout_constraintBottom_toBottomOf="@id/devices_list"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:id="@+id/actions"