minimum of 30 min for unreachable alert

This commit is contained in:
AdrianLxM 2018-01-21 19:05:04 +01:00
parent eedc38fbcf
commit 3962808626
2 changed files with 22 additions and 4 deletions

View file

@ -82,7 +82,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
Manifest.permission.WRITE_EXTERNAL_STORAGE}, CASE_STORAGE);
}
askForBatteryOptimizationPermission();
checkUpgradeToProfileTarget();
doMigrations();
if (Config.logFunctionCalls)
log.debug("onCreate");
@ -163,6 +163,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
}
private void doMigrations() {
checkUpgradeToProfileTarget();
// guarantee that the unreachable threshold is at least 30 and of type String
// Added in 1.57 at 21.01.2018
Integer unreachable_threshold = SP.getInt(R.string.key_pump_unreachable_threshold, 30);
SP.remove(R.string.key_pump_unreachable_threshold);
if(unreachable_threshold < 30) unreachable_threshold = 30;
SP.putString(R.string.key_pump_unreachable_threshold, unreachable_threshold.toString());
}
private void checkUpgradeToProfileTarget() { // TODO: can be removed in the future
boolean oldKeyExists = SP.contains("openapsma_min_bg");
if (oldKeyExists) {

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:validate="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="others"
android:title="@string/othersettings_title">
@ -76,12 +77,16 @@
android:defaultValue="true"
android:key="@string/key_enable_pump_unreachable_alert"
android:title="@string/enable_pump_unreachable_alert" />
<EditTextPreference
<com.andreabaccega.widget.ValidatingEditTextPreference
validate:testType="numericRange"
validate:minNumber="30"
validate:maxNumber="300"
android:defaultValue="30"
android:dependency="@string/key_enable_pump_unreachable_alert"
android:inputType="number"
android:key="@string/key_pump_unreachable_threshold"
android:title="@string/pump_unreachable_threshold"></EditTextPreference>
android:title="@string/pump_unreachable_threshold">
</com.andreabaccega.widget.ValidatingEditTextPreference>
</PreferenceScreen>
<SwitchPreference
android:defaultValue="false"