Wear New graph settings

This commit is contained in:
Philoul 2023-09-23 12:54:11 +02:00
parent ccabee0399
commit 7d6d10c75f
3 changed files with 66 additions and 11 deletions

View file

@ -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
}

View file

@ -44,6 +44,9 @@
<string name="pref_show_bgi">Show BGI</string>
<string name="pref_show_direction_arrow">Show Direction Arrow</string>
<string name="pref_show_ago">Show Ago</string>
<string name="pref_show_temp_basal">Show TBR</string>
<string name="pref_show_bolus">Show Bolus &amp; SMB</string>
<string name="pref_show_grid">Show Grid</string>
<string name="pref_dark" comment="Enables dark visual theme">Dark</string>
<string name="pref_highlight_basals">Highlight Basals</string>
<string name="pref_prediction_lines">Show predictions</string>
@ -192,6 +195,11 @@
<string name="key_show_wizard" translatable="false">showWizard</string>
<string name="key_single_target" translatable="false">singletarget</string>
<string name="key_wizard_percentage" translatable="false">wizardpercentage</string>
<string name="key_show_graph_basal" translatable="false">show_graph_basal</string>
<string name="key_show_graph_temp_basal" translatable="false">show_graph_temp_basal</string>
<string name="key_show_graph_carbs" translatable="false">show_graph_carbs</string>
<string name="key_show_graph_bolus" translatable="false">show_graph_bolus</string>
<string name="key_show_graph_grid" translatable="false">show_graph_grid</string>
<string name="key_highlight_basals" translatable="false">highlight_basals</string>
<string name="key_prediction_lines" translatable="false">prediction_lines</string>
<string name="key_chart_time_frame" translatable="false">chart_time_frame</string>

View file

@ -2,6 +2,38 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/key_show_graph_carbs"
android:summary="Show Carbs point in graphs"
android:title="@string/pref_show_cob"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/key_show_graph_bolus"
android:summary="show bolus and SMB"
android:title="@string/pref_show_bolus"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/key_show_graph_temp_basal"
android:summary="show basal rates"
android:title="@string/pref_show_temp_basal"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/key_show_graph_basal"
android:summary="show basal rates"
android:title="@string/pref_show_basal_rate"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/key_highlight_basals"
@ -18,6 +50,14 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/key_show_graph_grid"
android:summary="show prediction lines"
android:title="@string/pref_show_grid"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<ListPreference
android:defaultValue="3"
android:entries="@array/chart_timeframe"