diff --git a/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt index 75dd5edd..e180432d 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/SettingsScreen.kt @@ -1409,8 +1409,11 @@ private fun checkOnClick(ctx: Context) { if (newColorblind) "yes" else "no" ) BaresipService.colorblind = newColorblind + UserAgent.updateColorblindStatus() + val baresipService = Intent(ctx, BaresipService::class.java) + baresipService.action = "Update Notification" + ctx.startService(baresipService) save = true - restart = true } if ((Config.variable("log_level") == "0") != newDebug) { diff --git a/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt b/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt index f998f81b..4fa82c66 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt @@ -105,6 +105,28 @@ class UserAgent(val uap: Long) { } } + fun updateColorblindStatus() { + val updatedUas = uas.value.toMutableList() + for (ua in updatedUas) + ua.status = + if (BaresipService.colorblind) + when (ua.status) { + R.drawable.circle_green -> R.drawable.circle_green_blind + R.drawable.circle_yellow -> R.drawable.circle_yellow_blind + R.drawable.circle_red -> R.drawable.circle_red_blind + else -> R.drawable.circle_white + } + else + when (ua.status) { + R.drawable.circle_green_blind -> R.drawable.circle_green + R.drawable.circle_yellow_blind -> R.drawable.circle_yellow + R.drawable.circle_red_blind -> R.drawable.circle_red + else -> R.drawable.circle_white + } + uas.value = updatedUas.toList() + uasStatus.value = statusMap() + } + fun statusMap(): Map { val result = emptyMap().toMutableMap() for (ua in uas.value)