Updated disabled color in accounts list in drawer menu

This commit is contained in:
Sylvain Berfini 2023-09-22 11:04:50 +02:00
parent 262d6d551b
commit 1b2f6f4e3d
3 changed files with 24 additions and 14 deletions

View file

@ -55,6 +55,8 @@ class AccountModel @WorkerThread constructor(
val inError = MutableLiveData<Boolean>()
val isDisabled = MutableLiveData<Boolean>()
val isDefault = MutableLiveData<Boolean>()
val showTrust = MutableLiveData<Boolean>()
@ -141,23 +143,33 @@ class AccountModel @WorkerThread constructor(
isDefault.postValue(coreContext.core.defaultAccount == account)
val state = when (account.state) {
RegistrationState.None, RegistrationState.Cleared -> AppUtils.getString(
R.string.drawer_menu_account_connection_status_cleared
)
RegistrationState.None, RegistrationState.Cleared -> {
isDisabled.postValue(true)
AppUtils.getString(
R.string.drawer_menu_account_connection_status_cleared
)
}
RegistrationState.Progress -> AppUtils.getString(
R.string.drawer_menu_account_connection_status_progress
)
RegistrationState.Failed -> AppUtils.getString(
R.string.drawer_menu_account_connection_status_failed
)
RegistrationState.Ok -> AppUtils.getString(
R.string.drawer_menu_account_connection_status_connected
)
RegistrationState.Failed -> {
inError.postValue(true)
AppUtils.getString(
R.string.drawer_menu_account_connection_status_failed
)
}
RegistrationState.Ok -> {
isConnected.postValue(true)
AppUtils.getString(
R.string.drawer_menu_account_connection_status_connected
)
}
RegistrationState.Refreshing -> AppUtils.getString(
R.string.drawer_menu_account_connection_status_refreshing
)
else -> "${account.state}"
}
registrationState.postValue(state)
val summary = when (account.state) {
RegistrationState.None, RegistrationState.Cleared -> AppUtils.getString(
@ -175,10 +187,6 @@ class AccountModel @WorkerThread constructor(
else -> "${account.state}"
}
registrationStateSummary.postValue(summary)
isConnected.postValue(account.state == RegistrationState.Ok)
inError.postValue(account.state == RegistrationState.Failed)
registrationState.postValue(state)
}
}

View file

@ -85,7 +85,7 @@
android:background="@drawable/shape_squircle_gray_3_background"
android:gravity="center"
android:text="@{model.registrationState, default=@string/drawer_menu_account_connection_status_connected}"
android:textColor="@{model.isConnected ? @color/green_success_500 : model.inError ? @color/red_danger_500 : @color/gray_main2_500, default=@color/green_success_500}"
android:textColor="@{model.isConnected ? @color/green_success_500 : model.inError ? @color/red_danger_500 : model.isDisabled ? @color/orange_warning_600 : @color/gray_main2_500, default=@color/green_success_500}"
android:textSize="12sp"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@id/name"

View file

@ -38,5 +38,7 @@
<color name="blue_info_500">#4AA8FF</color>
<color name="orange_warning_600">#DBB820</color>
<color name="orange_away">#FFA645</color>
</resources>