From 7d6d10c75fa54cf11eaade0dd8801701bee8c7c7 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 23 Sep 2023 12:54:11 +0200 Subject: [PATCH] Wear New graph settings --- .../watchfaces/utils/BgGraphBuilder.kt | 29 +++++++++----- wear/src/main/res/values/strings.xml | 8 ++++ wear/src/main/res/xml/graph_preferences.xml | 40 +++++++++++++++++++ 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/utils/BgGraphBuilder.kt b/wear/src/main/java/info/nightscout/androidaps/watchfaces/utils/BgGraphBuilder.kt index 0af955c525..c6d17c9a75 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/utils/BgGraphBuilder.kt +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/utils/BgGraphBuilder.kt @@ -82,8 +82,10 @@ class BgGraphBuilder( fun lineData(): LineChartData { val lineData = LineChartData(defaultLines()) - lineData.axisYLeft = yAxis() - lineData.axisXBottom = xAxis() + if (sp.getBoolean(R.string.key_show_graph_grid, true)) { + lineData.axisYLeft = yAxis() + lineData.axisXBottom = xAxis() + } return lineData } @@ -113,19 +115,24 @@ class BgGraphBuilder( // in case basal is the highest, don't paint it totally at the top. factor = min(factor, (maxChart - minChart) / maxBasal * (2 / 3.0)) val highlight = sp.getBoolean(R.string.key_highlight_basals, false) - for (twd in tempWatchDataList) { - if (twd.endTime > startingTime) { - lines.add(tempValuesLine(twd, minChart.toFloat(), factor, false, if (highlight) pointSize + 1 else pointSize)) - if (highlight) lines.add(tempValuesLine(twd, minChart.toFloat(), factor, true, 1)) + if (sp.getBoolean(R.string.key_show_graph_temp_basal, true)) + for (twd in tempWatchDataList) { + if (twd.endTime > startingTime) { + lines.add(tempValuesLine(twd, minChart.toFloat(), factor, false, if (highlight) pointSize + 1 else pointSize)) + if (highlight) lines.add(tempValuesLine(twd, minChart.toFloat(), factor, true, 1)) + } } - } if (sp.getBoolean(R.string.key_prediction_lines, true)) addPredictionLines(lines) - lines.add(basalLine(minChart.toFloat(), factor, highlight)) - lines.add(bolusLine(minChart.toFloat())) + if (sp.getBoolean(R.string.key_show_graph_basal, true)) + lines.add(basalLine(minChart.toFloat(), factor, highlight)) lines.add(bolusInvalidLine(minChart.toFloat())) - lines.add(carbsLine(minChart.toFloat())) - lines.add(smbLine(minChart.toFloat())) + if (sp.getBoolean(R.string.key_show_graph_carbs, true)) + lines.add(carbsLine(minChart.toFloat())) + if (sp.getBoolean(R.string.key_show_graph_bolus, true)) { + lines.add(bolusLine(minChart.toFloat())) + lines.add(smbLine(minChart.toFloat())) + } return lines } diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml index 81b770c83f..2b21dcbc16 100644 --- a/wear/src/main/res/values/strings.xml +++ b/wear/src/main/res/values/strings.xml @@ -44,6 +44,9 @@ Show BGI Show Direction Arrow Show Ago + Show TBR + Show Bolus & SMB + Show Grid Dark Highlight Basals Show predictions @@ -192,6 +195,11 @@ showWizard singletarget wizardpercentage + show_graph_basal + show_graph_temp_basal + show_graph_carbs + show_graph_bolus + show_graph_grid highlight_basals prediction_lines chart_time_frame diff --git a/wear/src/main/res/xml/graph_preferences.xml b/wear/src/main/res/xml/graph_preferences.xml index 2ea1779240..a1d90aca27 100644 --- a/wear/src/main/res/xml/graph_preferences.xml +++ b/wear/src/main/res/xml/graph_preferences.xml @@ -2,6 +2,38 @@ + + + + + + + + + +