From 4702a87d8eff6ed04e14108247bc2bf625d56eae Mon Sep 17 00:00:00 2001 From: LadyViktoria Date: Thu, 26 Jan 2017 12:07:25 +0100 Subject: [PATCH] Add prefernces.json add safety limits --- app/build.gradle | 2 + .../androidaps/PreferencesActivity.java | 8 +++- app/src/main/res/xml/pref_advanced.xml | 40 +++++++++++++++---- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b7600175b6..f2e3ed0cc7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,6 +12,7 @@ apply plugin: 'io.fabric' repositories { maven { url 'https://maven.fabric.io/public' } + maven { url "https://jitpack.io" } } def generateGitBuild = { -> @@ -134,4 +135,5 @@ dependencies { androidTestCompile 'org.mockito:mockito-core:2.+' androidTestCompile "com.google.dexmaker:dexmaker:1.2" androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2" + compile 'com.andreabaccega:android-edittext-validator:1.3.0' } diff --git a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java index 9506792926..1054395380 100644 --- a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java @@ -11,6 +11,9 @@ import android.preference.PreferenceFragment; import android.preference.PreferenceGroup; import android.preference.PreferenceManager; import android.preference.SwitchPreference; +import android.view.View; + +import com.andreabaccega.widget.FormEditText; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventRefreshGui; @@ -30,6 +33,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre myPreferenceFragment = new MyPreferenceFragment(); getFragmentManager().beginTransaction().replace(android.R.id.content, myPreferenceFragment).commit(); PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this); + } @Override @@ -45,7 +49,9 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre MainApp.bus().post(new EventRefreshGui(true)); } updatePrefSummary(myPreferenceFragment.getPreference(key)); - } + + +} private static void updatePrefSummary(Preference pref) { if (pref instanceof ListPreference || pref instanceof BluetoothDevicePreference) { diff --git a/app/src/main/res/xml/pref_advanced.xml b/app/src/main/res/xml/pref_advanced.xml index c6b6e3d8b3..9fe500d70e 100644 --- a/app/src/main/res/xml/pref_advanced.xml +++ b/app/src/main/res/xml/pref_advanced.xml @@ -1,5 +1,6 @@ - + @@ -33,7 +34,11 @@ android:action="android.intent.action.VIEW" android:data="@string/openapsama_link_to_preferncejson_doc" /> - - - - - -