From ca190f1c4e6c1919b34f5be7cc7a3124518e30e2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 21 Aug 2023 16:17:43 +0200 Subject: [PATCH] disable activity chart by default --- .../nightscout/interfaces/overview/OverviewMenus.kt | 2 +- .../plugins/general/overview/OverviewMenusImpl.kt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/overview/OverviewMenus.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/overview/OverviewMenus.kt index 9622530524..0dd3c7e3d6 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/overview/OverviewMenus.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/overview/OverviewMenus.kt @@ -16,7 +16,7 @@ interface OverviewMenus { SEN, ACT, DEVSLOPE, - HR, + HR } val setting: List> diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewMenusImpl.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewMenusImpl.kt index b4fb21b8e9..b8871d5beb 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewMenusImpl.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewMenusImpl.kt @@ -36,10 +36,10 @@ class OverviewMenusImpl @Inject constructor( private val fabricPrivacy: FabricPrivacy ) : OverviewMenus { - enum class CharTypeData(@StringRes val nameId: Int, @AttrRes val attrId: Int, @AttrRes val attrTextId: Int, val primary: Boolean, val secondary: Boolean, @StringRes val shortnameId: Int) { - PRE(R.string.overview_show_predictions, info.nightscout.core.ui.R.attr.predictionColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.prediction_shortname), - TREAT(R.string.overview_show_treatments, info.nightscout.core.ui.R.attr.cobColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.treatments_shortname), - BAS(R.string.overview_show_basals, info.nightscout.core.ui.R.attr.basal, info.nightscout.core.ui.R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.basal_shortname), + enum class CharTypeData(@StringRes val nameId: Int, @AttrRes val attrId: Int, @AttrRes val attrTextId: Int, val primary: Boolean, val secondary: Boolean, @StringRes val shortnameId: Int, val enabledByDefault: Boolean = false) { + PRE(R.string.overview_show_predictions, info.nightscout.core.ui.R.attr.predictionColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.prediction_shortname, enabledByDefault = true), + TREAT(R.string.overview_show_treatments, info.nightscout.core.ui.R.attr.cobColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.treatments_shortname, enabledByDefault = true), + BAS(R.string.overview_show_basals, info.nightscout.core.ui.R.attr.basal, info.nightscout.core.ui.R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.basal_shortname, enabledByDefault = true), ABS(R.string.overview_show_abs_insulin, info.nightscout.core.ui.R.attr.iobColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.abs_insulin_shortname), IOB(R.string.overview_show_iob, info.nightscout.core.ui.R.attr.iobColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = false, secondary = true, shortnameId = info.nightscout.core.ui.R.string.iob), COB(R.string.overview_show_cob, info.nightscout.core.ui.R.attr.cobColor, info.nightscout.core.ui.R.attr.menuTextColor, primary = false, secondary = true, shortnameId = info.nightscout.core.ui.R.string.cob), @@ -80,6 +80,7 @@ class OverviewMenusImpl @Inject constructor( @Synchronized override fun loadGraphConfig() { + assert(CharTypeData.values().size == OverviewMenus.CharType.values().size) val sts = sp.getString(R.string.key_graph_config, "") if (sts.isNotEmpty()) { _setting = Gson().fromJson(sts, Array>::class.java).toMutableList() @@ -87,11 +88,11 @@ class OverviewMenusImpl @Inject constructor( for (s in _setting) if (s.size != OverviewMenus.CharType.values().size) { _setting = ArrayList() - _setting.add(Array(OverviewMenus.CharType.values().size) { true }) + _setting.add(Array(OverviewMenus.CharType.values().size) { CharTypeData.values()[it].enabledByDefault }) } } else { _setting = ArrayList() - _setting.add(Array(OverviewMenus.CharType.values().size) { true }) + _setting.add(Array(OverviewMenus.CharType.values().size) { CharTypeData.values()[it].enabledByDefault }) } }