Updated UI when contact no trusted device

This commit is contained in:
Sylvain Berfini 2024-12-12 14:01:06 +01:00
parent 5593e06cf5
commit 86e2c731da
2 changed files with 9 additions and 5 deletions

View file

@ -638,7 +638,11 @@ class ContactViewModel
if (devicesList.isNotEmpty()) {
val percentage = trustedDevicesCount * 100 / devicesCount
trustedDevicesPercentage.postValue(percentage)
trustedDevicesPercentageFloat.postValue(percentage / 100f / 2)
if (percentage == 0) {
trustedDevicesPercentageFloat.postValue(0.5f)
} else {
trustedDevicesPercentageFloat.postValue(percentage / 100f / 2)
}
}
}

View file

@ -429,7 +429,7 @@
android:layout_marginStart="3dp"
android:layout_marginEnd="3dp"
android:max="100"
android:progress="@{viewModel.trustedDevicesPercentage, default=20}"
android:progress="@{viewModel.trustedDevicesPercentage, default=0}"
app:trackCornerRadius="50dp"
app:trackThickness="22dp"
app:trackColor="@color/transparent_color"
@ -447,10 +447,10 @@
android:layout_height="0dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:text="@{String.valueOf(viewModel.trustedDevicesPercentage) + `%`, default=`20%`}"
android:textColor="@{viewModel.trustedDevicesPercentage > 15 ? @color/bc_white : @color/gray_main2_400, default=@color/bc_white}"
android:text="@{String.valueOf(viewModel.trustedDevicesPercentage) + `%`, default=`0%`}"
android:textColor="@{viewModel.trustedDevicesPercentage > 15 ? @color/bc_white : @color/red_danger_500_night, default=@color/red_danger_500_night}"
android:textSize="12sp"
app:layout_constraintHorizontal_bias="@{viewModel.trustedDevicesPercentageFloat, default=0.1}"
app:layout_constraintHorizontal_bias="@{viewModel.trustedDevicesPercentageFloat, default=0.5}"
app:layout_constraintStart_toStartOf="@id/trusted_devices_progress"
app:layout_constraintEnd_toEndOf="@id/trusted_devices_progress"
app:layout_constraintTop_toTopOf="@id/trusted_devices_progress"