Add prefernces.json add safety limits
This commit is contained in:
parent
2f8b2a382d
commit
4702a87d8e
3 changed files with 41 additions and 9 deletions
|
@ -12,6 +12,7 @@ apply plugin: 'io.fabric'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'https://maven.fabric.io/public' }
|
maven { url 'https://maven.fabric.io/public' }
|
||||||
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
|
|
||||||
def generateGitBuild = { ->
|
def generateGitBuild = { ->
|
||||||
|
@ -134,4 +135,5 @@ dependencies {
|
||||||
androidTestCompile 'org.mockito:mockito-core:2.+'
|
androidTestCompile 'org.mockito:mockito-core:2.+'
|
||||||
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
|
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
|
||||||
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
|
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
|
||||||
|
compile 'com.andreabaccega:android-edittext-validator:1.3.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@ import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.preference.SwitchPreference;
|
import android.preference.SwitchPreference;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.andreabaccega.widget.FormEditText;
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
|
@ -30,6 +33,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
myPreferenceFragment = new MyPreferenceFragment();
|
myPreferenceFragment = new MyPreferenceFragment();
|
||||||
getFragmentManager().beginTransaction().replace(android.R.id.content, myPreferenceFragment).commit();
|
getFragmentManager().beginTransaction().replace(android.R.id.content, myPreferenceFragment).commit();
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
|
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,6 +49,8 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
MainApp.bus().post(new EventRefreshGui(true));
|
MainApp.bus().post(new EventRefreshGui(true));
|
||||||
}
|
}
|
||||||
updatePrefSummary(myPreferenceFragment.getPreference(key));
|
updatePrefSummary(myPreferenceFragment.getPreference(key));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updatePrefSummary(Preference pref) {
|
private static void updatePrefSummary(Preference pref) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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
|
<PreferenceCategory
|
||||||
android:key="advanced"
|
android:key="advanced"
|
||||||
android:title="@string/advancedsettings_title">
|
android:title="@string/advancedsettings_title">
|
||||||
|
@ -33,7 +34,11 @@
|
||||||
android:action="android.intent.action.VIEW"
|
android:action="android.intent.action.VIEW"
|
||||||
android:data="@string/openapsama_link_to_preferncejson_doc" />
|
android:data="@string/openapsama_link_to_preferncejson_doc" />
|
||||||
</Preference>
|
</Preference>
|
||||||
<EditTextPreference
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
|
validate:testType="numericRange"
|
||||||
|
validate:minNumber="1"
|
||||||
|
validate:maxNumber="10"
|
||||||
|
android:digits="0123456789.,"
|
||||||
android:defaultValue="3"
|
android:defaultValue="3"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
|
@ -41,7 +46,12 @@
|
||||||
android:title="@string/openapsama_max_daily_safety_multiplier"
|
android:title="@string/openapsama_max_daily_safety_multiplier"
|
||||||
android:dialogMessage="@string/openapsama_max_daily_safety_multiplier_summary"
|
android:dialogMessage="@string/openapsama_max_daily_safety_multiplier_summary"
|
||||||
android:key="openapsama_max_daily_safety_multiplier" />
|
android:key="openapsama_max_daily_safety_multiplier" />
|
||||||
<EditTextPreference
|
|
||||||
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
|
validate:testType="numericRange"
|
||||||
|
validate:minNumber="1"
|
||||||
|
validate:maxNumber="10"
|
||||||
|
android:digits="0123456789.,"
|
||||||
android:defaultValue="4"
|
android:defaultValue="4"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@ -50,7 +60,11 @@
|
||||||
android:title="@string/openapsama_current_basal_safety_multiplier"
|
android:title="@string/openapsama_current_basal_safety_multiplier"
|
||||||
android:dialogMessage="@string/openapsama_current_basal_safety_multiplier_summary"
|
android:dialogMessage="@string/openapsama_current_basal_safety_multiplier_summary"
|
||||||
android:key="openapsama_current_basal_safety_multiplier" />
|
android:key="openapsama_current_basal_safety_multiplier" />
|
||||||
<EditTextPreference
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
|
validate:testType="floatNumericRange"
|
||||||
|
validate:minNumber="0"
|
||||||
|
validate:maxNumber="10"
|
||||||
|
android:digits="0123456789.,"
|
||||||
android:defaultValue="1.2"
|
android:defaultValue="1.2"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@ -60,7 +74,10 @@
|
||||||
android:dialogMessage="@string/openapsama_autosens_max_summary"
|
android:dialogMessage="@string/openapsama_autosens_max_summary"
|
||||||
android:key="openapsama_autosens_max"
|
android:key="openapsama_autosens_max"
|
||||||
android:dependency="openapsama_useautosens"/>
|
android:dependency="openapsama_useautosens"/>
|
||||||
<EditTextPreference
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
|
validate:testType="floatNumericRange"
|
||||||
|
validate:minNumber="0"
|
||||||
|
validate:maxNumber="10"
|
||||||
android:defaultValue="0.7"
|
android:defaultValue="0.7"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@ -94,7 +111,11 @@
|
||||||
android:dependency="openapsama_useautosens" />
|
android:dependency="openapsama_useautosens" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<EditTextPreference
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
|
validate:testType="numericRange"
|
||||||
|
validate:minNumber="1"
|
||||||
|
validate:maxNumber="10"
|
||||||
|
android:digits="0123456789.,"
|
||||||
android:defaultValue="2"
|
android:defaultValue="2"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@ -103,8 +124,11 @@
|
||||||
android:title="@string/openapsama_bolussnooze_dia_divisor"
|
android:title="@string/openapsama_bolussnooze_dia_divisor"
|
||||||
android:dialogMessage="@string/openapsama_bolussnooze_dia_divisor_summary"
|
android:dialogMessage="@string/openapsama_bolussnooze_dia_divisor_summary"
|
||||||
android:key="openapsama_bolussnooze_dia_divisor" />
|
android:key="openapsama_bolussnooze_dia_divisor" />
|
||||||
<EditTextPreference
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
android:defaultValue="3"
|
validate:testType="floatNumericRange"
|
||||||
|
validate:minNumber="0"
|
||||||
|
validate:maxNumber="10"
|
||||||
|
android:defaultValue="3.0"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:inputType="numberDecimal"
|
android:inputType="numberDecimal"
|
||||||
|
|
Loading…
Reference in a new issue