simplify statuslights preferences

This commit is contained in:
Milos Kozak 2019-09-15 11:42:01 +02:00
parent 4d23fb1d61
commit 50041e1733
3 changed files with 10 additions and 24 deletions

View file

@ -1323,23 +1323,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
cobView.setText(cobText); cobView.setText(cobText);
} }
if (statuslightsLayout != null && SP.getBoolean(R.string.key_show_statuslights, false)) { if (statuslightsLayout != null)
StatuslightHandler handler = new StatuslightHandler(); if (SP.getBoolean(R.string.key_show_statuslights, false)) {
StatuslightHandler handler = new StatuslightHandler();
if (SP.getBoolean(R.string.key_show_statuslights_easy, false)) { if (SP.getBoolean(R.string.key_show_statuslights_extended, false)) {
handler.statuslight(cageView, iageView, reservoirView, sageView, batteryView); handler.extendedStatuslight(cageView, iageView, reservoirView, sageView, batteryView);
statuslightsLayout.setVisibility(View.VISIBLE);
statuslightsLayout.setVisibility(View.VISIBLE); } else {
} else if (SP.getBoolean(R.string.key_show_statuslights_extended, false)) { handler.statuslight(cageView, iageView, reservoirView, sageView, batteryView);
handler.extendedStatuslight(cageView, iageView, reservoirView, sageView, batteryView); statuslightsLayout.setVisibility(View.VISIBLE);
}
statuslightsLayout.setVisibility(View.VISIBLE);
} else { } else {
statuslightsLayout.setVisibility(View.GONE); statuslightsLayout.setVisibility(View.GONE);
} }
} else if (statuslightsLayout != null) {
statuslightsLayout.setVisibility(View.GONE);
}
boolean predictionsAvailable; boolean predictionsAvailable;
if (Config.APS) if (Config.APS)

View file

@ -623,11 +623,8 @@
<string name="enablesuperbolus">Enable superbolus in wizard</string> <string name="enablesuperbolus">Enable superbolus in wizard</string>
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string> <string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
<string name="key_show_statuslights" translatable="false">key_show_statuslights</string> <string name="key_show_statuslights" translatable="false">key_show_statuslights</string>
<string name="key_show_statuslights_easy" translatable="false">key_show_statuslights_easy</string>
<string name="key_show_statuslights_extended" translatable="false">key_show_statuslights_extended</string> <string name="key_show_statuslights_extended" translatable="false">key_show_statuslights_extended</string>
<string name="show_statuslights">Show status lights on home screen</string> <string name="show_statuslights">Show status lights on home screen</string>
<string name="show_statuslights_easy">Show original status lights on home screen</string>
<string name="show_statuslights_easy_summary">Enable original status lights for cage, iage, sage, reservoir and battery level on home screen.</string>
<string name="show_statuslights_extended">Show extended status lights on home screen</string> <string name="show_statuslights_extended">Show extended status lights on home screen</string>
<string name="show_statuslights_extended_summary">Enable extended status lights for cage, iage, sage, reservoir and battery level on home screen.</string> <string name="show_statuslights_extended_summary">Enable extended status lights for cage, iage, sage, reservoir and battery level on home screen.</string>
<string name="key_statuslights_res_warning" translatable="false">key_statuslights_res_warning</string> <string name="key_statuslights_res_warning" translatable="false">key_statuslights_res_warning</string>

View file

@ -167,13 +167,6 @@
android:key="@string/key_show_statuslights" android:key="@string/key_show_statuslights"
android:title="@string/show_statuslights" /> android:title="@string/show_statuslights" />
<SwitchPreference
android:defaultValue="false"
android:dependency="@string/key_show_statuslights"
android:key="@string/key_show_statuslights_easy"
android:summary="@string/show_statuslights_easy_summary"
android:title="@string/show_statuslights_easy" />
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:dependency="@string/key_show_statuslights" android:dependency="@string/key_show_statuslights"