Include Loop pref and fix bgi visdibility

This commit is contained in:
Philoul 2023-08-19 22:38:21 +02:00
parent b5a47af79a
commit 60375978ad
3 changed files with 6 additions and 4 deletions

View file

@ -110,7 +110,8 @@ enum class CustomWatchfaceMetadataKey(val key: String, @StringRes val label: Int
CWF_PREF_WATCH_SHOW_TEMP_BASAL("key_show_temp_basal", R.string.metadata_label_watchface_pref),
CWF_PREF_WATCH_SHOW_DIRECTION("key_show_direction", R.string.metadata_label_watchface_pref),
CWF_PREF_WATCH_SHOW_AGO("key_show_ago", R.string.metadata_label_watchface_pref),
CWF_PREF_WATCH_SHOW_BG("key_show_bg", R.string.metadata_label_watchface_pref);
CWF_PREF_WATCH_SHOW_BG("key_show_bg", R.string.metadata_label_watchface_pref),
CWF_PREF_WATCH_SHOW_LOOP_STATUS("key_show_loop_status", R.string.metadata_label_watchface_pref);
companion object {
fun fromKey(key: String): CustomWatchfaceMetadataKey? =
values().firstOrNull { it.key == key }

View file

@ -400,7 +400,7 @@ class CustomWatchface : BaseWatchFace() {
UPLOADER_BATTERY("uploader_battery", R.id.uploader_battery, R.string.key_show_uploader_battery),
RIG_BATTERY("rig_battery", R.id.rig_battery, R.string.key_show_rig_battery),
BASALRATE("basalRate", R.id.basalRate, R.string.key_show_temp_basal),
BGI("bgi", R.id.bgi, null),
BGI("bgi", R.id.bgi, R.string.key_show_bgi),
TIME("time", R.id.time, null),
HOUR("hour", R.id.hour, null),
MINUTE("minute", R.id.minute, null),
@ -503,7 +503,8 @@ class CustomWatchface : BaseWatchFace() {
SHOW_DIRECTION(CustomWatchfaceMetadataKey.CWF_PREF_WATCH_SHOW_DIRECTION.key, R.string.key_show_direction),
SHOW_AGO(CustomWatchfaceMetadataKey.CWF_PREF_WATCH_SHOW_AGO.key, R.string.key_show_ago),
SHOW_BG(CustomWatchfaceMetadataKey.CWF_PREF_WATCH_SHOW_BG.key, R.string.key_show_bg),
SHOW_BGI(CustomWatchfaceMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi)
SHOW_BGI(CustomWatchfaceMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi),
SHOW_LOOP_STATUS(CustomWatchfaceMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status)
}
}

View file

@ -330,7 +330,7 @@ abstract class BaseWatchFace : WatchFace() {
binding.basalRate?.text = status.currentBasal
binding.basalRate?.visibility = sp.getBoolean(R.string.key_show_temp_basal, true).toVisibility()
binding.bgi?.text = status.bgi
binding.bgi?.visibility = sp.getBoolean(R.string.key_show_bgi, true).toVisibility()
binding.bgi?.visibility = showBgi.toVisibility()
val iobString =
if (detailedIob) "${status.iobSum} ${status.iobDetail}"
else status.iobSum + getString(R.string.units_short)