Merge pull request #2172 from gregorybel/feature/expand-status-light

Add possibility to show Battery info in days instead of percent
This commit is contained in:
Milos Kozak 2019-12-02 08:35:15 +01:00 committed by GitHub
commit 8496f7dc18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment; import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus; import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SetWarnColor; import info.nightscout.androidaps.utils.SetWarnColor;
@ -34,10 +35,14 @@ class StatuslightHandler {
applyStatuslight("sage", CareportalEvent.SENSORCHANGE, sageView, "SEN", 164, 166); applyStatuslight("sage", CareportalEvent.SENSORCHANGE, sageView, "SEN", 164, 166);
if (pump.model() != PumpType.AccuChekCombo) {
double batteryLevel = pump.isInitialized() ? pump.getBatteryLevel() : -1; double batteryLevel = pump.isInitialized() ? pump.getBatteryLevel() : -1;
applyStatuslightLevel(R.string.key_statuslights_bat_critical, 5.0, applyStatuslightLevel(R.string.key_statuslights_bat_critical, 5.0,
R.string.key_statuslights_bat_warning, 22.0, R.string.key_statuslights_bat_warning, 22.0,
batteryView, "BAT", batteryLevel); batteryView, "BAT", batteryLevel);
} else {
applyStatuslight("bage", CareportalEvent.PUMPBATTERYCHANGE, batteryView, "BAT", 504, 240);
}
} }
@ -105,9 +110,14 @@ class StatuslightHandler {
handleAge("sage", CareportalEvent.SENSORCHANGE, sageView, "SEN ", handleAge("sage", CareportalEvent.SENSORCHANGE, sageView, "SEN ",
164, 166); 164, 166);
if (pump.model() != PumpType.AccuChekCombo) {
handleLevel(R.string.key_statuslights_bat_critical, 26.0, handleLevel(R.string.key_statuslights_bat_critical, 26.0,
R.string.key_statuslights_bat_warning, 51.0, R.string.key_statuslights_bat_warning, 51.0,
batteryView, "BAT ", pump.getBatteryLevel()); batteryView, "BAT ", pump.getBatteryLevel());
} else {
handleAge("bage", CareportalEvent.PUMPBATTERYCHANGE, batteryView, "BAT ",
336, 240);
}
} }
void handleAge(String nsSettingPlugin, String eventName, TextView view, String text, void handleAge(String nsSettingPlugin, String eventName, TextView view, String text,