From ab41ffa83ecda96037e1d74f131d3401cd230e42 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 26 Oct 2020 09:58:11 +0100 Subject: [PATCH] Allow BT watchdog setting for all pumps --- .../activities/MyPreferenceFragment.kt | 5 +++++ app/src/main/res/xml/pref_pump.xml | 17 +++++++++++++++++ danar/src/main/res/xml/pref_danar.xml | 17 ----------------- danar/src/main/res/xml/pref_danarkorean.xml | 16 ---------------- danar/src/main/res/xml/pref_danarv2.xml | 16 ---------------- danars/src/main/res/xml/pref_danars.xml | 16 ---------------- 6 files changed, 22 insertions(+), 65 deletions(-) create mode 100644 app/src/main/res/xml/pref_pump.xml diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index cdb280a186..705c377afa 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -175,6 +175,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, config.PUMPDRIVERS) + addPreferencesFromResource(R.xml.pref_pump, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey) addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey) addPreferencesFromResourceIfEnabled(nsClientPlugin, rootKey) @@ -251,6 +252,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } } + private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?, enabled: Boolean) { + if (enabled) addPreferencesFromResource(preferencesResId, key) + } + @SuppressLint("RestrictedApi") private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) { val xmlRoot = preferenceManager.inflateFromResource(context, diff --git a/app/src/main/res/xml/pref_pump.xml b/app/src/main/res/xml/pref_pump.xml new file mode 100644 index 0000000000..161692a698 --- /dev/null +++ b/app/src/main/res/xml/pref_pump.xml @@ -0,0 +1,17 @@ + + + + + + + + + + \ No newline at end of file diff --git a/danar/src/main/res/xml/pref_danar.xml b/danar/src/main/res/xml/pref_danar.xml index 64246a6544..27efaac878 100644 --- a/danar/src/main/res/xml/pref_danar.xml +++ b/danar/src/main/res/xml/pref_danar.xml @@ -38,23 +38,6 @@ android:key="@string/key_danar_visualizeextendedaspercentage" android:title="@string/danar_visualizeextendedaspercentage_title" /> - - - - - - - - - - \ No newline at end of file diff --git a/danar/src/main/res/xml/pref_danarkorean.xml b/danar/src/main/res/xml/pref_danarkorean.xml index c4de35face..5e46cdae54 100644 --- a/danar/src/main/res/xml/pref_danarkorean.xml +++ b/danar/src/main/res/xml/pref_danarkorean.xml @@ -31,22 +31,6 @@ android:key="@string/key_danar_visualizeextendedaspercentage" android:title="@string/danar_visualizeextendedaspercentage_title" /> - - - - - - - - - - \ No newline at end of file diff --git a/danar/src/main/res/xml/pref_danarv2.xml b/danar/src/main/res/xml/pref_danarv2.xml index d31b25f699..d0d36999a5 100644 --- a/danar/src/main/res/xml/pref_danarv2.xml +++ b/danar/src/main/res/xml/pref_danarv2.xml @@ -27,22 +27,6 @@ android:key="@string/key_danars_bolusspeed" android:title="@string/bolusspeed" /> - - - - - - - - - - \ No newline at end of file diff --git a/danars/src/main/res/xml/pref_danars.xml b/danars/src/main/res/xml/pref_danars.xml index 1e35b65ee9..8fc3d691b4 100644 --- a/danars/src/main/res/xml/pref_danars.xml +++ b/danars/src/main/res/xml/pref_danars.xml @@ -42,22 +42,6 @@ android:summary="@string/rs_logcanulachange_summary" android:title="@string/rs_logcanulachange_title" /> - - - - - - - - - - \ No newline at end of file