Allow BT watchdog setting for all pumps

This commit is contained in:
Milos Kozak 2020-10-26 09:58:11 +01:00
parent 4d4733a58a
commit ab41ffa83e
6 changed files with 22 additions and 65 deletions

View file

@ -175,6 +175,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, config.PUMPDRIVERS)
addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, config.PUMPDRIVERS)
addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, config.PUMPDRIVERS)
addPreferencesFromResource(R.xml.pref_pump, rootKey, config.PUMPDRIVERS)
addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey) addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey)
addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey) addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey)
addPreferencesFromResourceIfEnabled(nsClientPlugin, 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") @SuppressLint("RestrictedApi")
private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) { private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) {
val xmlRoot = preferenceManager.inflateFromResource(context, val xmlRoot = preferenceManager.inflateFromResource(context,

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:title="@string/pump"
app:initialExpandedChildrenCount="0">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_btwatchdog"
android:summary="@string/btwatchdog_summary"
android:title="@string/btwatchdog_title" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>

View file

@ -38,23 +38,6 @@
android:key="@string/key_danar_visualizeextendedaspercentage" android:key="@string/key_danar_visualizeextendedaspercentage"
android:title="@string/danar_visualizeextendedaspercentage_title" /> android:title="@string/danar_visualizeextendedaspercentage_title" />
<androidx.preference.PreferenceScreen
android:key="absorption_danar_advanced"
android:title="@string/advancedsettings_title">
<PreferenceCategory
android:title="@string/bluetooth">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_btwatchdog"
android:summary="@string/btwatchdog_summary"
android:title="@string/btwatchdog_title" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

View file

@ -31,22 +31,6 @@
android:key="@string/key_danar_visualizeextendedaspercentage" android:key="@string/key_danar_visualizeextendedaspercentage"
android:title="@string/danar_visualizeextendedaspercentage_title" /> android:title="@string/danar_visualizeextendedaspercentage_title" />
<androidx.preference.PreferenceScreen
android:key="absorption_danarkorean_advanced"
android:title="@string/advancedsettings_title">
<PreferenceCategory android:title="@string/bluetooth">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_btwatchdog"
android:summary="@string/btwatchdog_summary"
android:title="@string/btwatchdog_title" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

View file

@ -27,22 +27,6 @@
android:key="@string/key_danars_bolusspeed" android:key="@string/key_danars_bolusspeed"
android:title="@string/bolusspeed" /> android:title="@string/bolusspeed" />
<androidx.preference.PreferenceScreen
android:key="absorption_danarv2_advanced"
android:title="@string/advancedsettings_title">
<PreferenceCategory android:title="@string/bluetooth">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_btwatchdog"
android:summary="@string/btwatchdog_summary"
android:title="@string/btwatchdog_title" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

View file

@ -42,22 +42,6 @@
android:summary="@string/rs_logcanulachange_summary" android:summary="@string/rs_logcanulachange_summary"
android:title="@string/rs_logcanulachange_title" /> android:title="@string/rs_logcanulachange_title" />
<androidx.preference.PreferenceScreen
android:key="absorption_danars_advanced"
android:title="@string/advancedsettings_title">
<PreferenceCategory android:title="@string/bluetooth">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_btwatchdog"
android:summary="@string/btwatchdog_summary"
android:title="@string/btwatchdog_title" />
</PreferenceCategory>
</androidx.preference.PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>