From 0d85ad4f69be4f4b9eff2745e34255346c07ba48 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 9 Jan 2020 21:41:02 +0100 Subject: [PATCH] Preference xml files cleanup --- app/build.gradle | 1 - .../activities/MyPreferenceFragment.kt | 56 +++--- .../textValidator/DefaultEditTextValidator.kt | 22 ++- .../textValidator/EditTextValidator.java | 6 + .../ValidatingEditTextPreference.kt | 5 +- .../validators/HttpsUrlValidator.kt | 9 + .../validators/MinDigitLengthValidator.kt | 12 ++ .../validators/MultiPhoneValidator.kt | 16 ++ .../validators/PatternValidator.kt | 4 + .../validators/WebUrlValidator.kt | 2 +- app/src/main/res/layout/dialog_preference.xml | 25 --- app/src/main/res/values/fet_attrs.xml | 4 + app/src/main/res/values/strings.xml | 3 +- app/src/main/res/values/validator.xml | 6 + app/src/main/res/xml/pref_absorption_aaps.xml | 10 +- .../main/res/xml/pref_absorption_oref0.xml | 12 +- .../main/res/xml/pref_absorption_oref1.xml | 12 +- app/src/main/res/xml/pref_age.xml | 13 -- app/src/main/res/xml/pref_alerts.xml | 47 +++++ app/src/main/res/xml/pref_automation.xml | 7 +- app/src/main/res/xml/pref_bgsource.xml | 7 +- app/src/main/res/xml/pref_bgsourcedexcom.xml | 7 +- app/src/main/res/xml/pref_danar.xml | 17 +- app/src/main/res/xml/pref_danarkorean.xml | 14 +- app/src/main/res/xml/pref_danars.xml | 17 +- app/src/main/res/xml/pref_danarv2.xml | 14 +- app/src/main/res/xml/pref_datachoices.xml | 27 +-- app/src/main/res/xml/pref_general.xml | 17 +- .../main/res/xml/pref_insight_local_full.xml | 10 +- .../xml/pref_insight_local_pumpcontrol.xml | 10 +- .../main/res/xml/pref_insulinoreffreepeak.xml | 19 +- app/src/main/res/xml/pref_loop.xml | 10 +- app/src/main/res/xml/pref_maintenance.xml | 25 ++- app/src/main/res/xml/pref_medtronic.xml | 37 ++-- .../main/res/xml/pref_nsclientinternal.xml | 29 +-- app/src/main/res/xml/pref_openapsama.xml | 30 +-- app/src/main/res/xml/pref_openapsma.xml | 24 ++- app/src/main/res/xml/pref_openapssmb.xml | 38 ++-- app/src/main/res/xml/pref_others.xml | 115 ------------ app/src/main/res/xml/pref_overview.xml | 136 +++++++++++++- app/src/main/res/xml/pref_password.xml | 14 -- app/src/main/res/xml/pref_safety.xml | 41 +++-- app/src/main/res/xml/pref_smscommunicator.xml | 33 ++-- app/src/main/res/xml/pref_tidepool.xml | 23 ++- app/src/main/res/xml/pref_virtualpump.xml | 20 +- app/src/main/res/xml/pref_wear.xml | 171 +++++++++--------- app/src/main/res/xml/pref_xdripstatus.xml | 18 +- 47 files changed, 705 insertions(+), 490 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/HttpsUrlValidator.kt create mode 100644 app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MinDigitLengthValidator.kt create mode 100644 app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MultiPhoneValidator.kt delete mode 100644 app/src/main/res/layout/dialog_preference.xml delete mode 100644 app/src/main/res/xml/pref_age.xml create mode 100644 app/src/main/res/xml/pref_alerts.xml delete mode 100644 app/src/main/res/xml/pref_others.xml delete mode 100644 app/src/main/res/xml/pref_password.xml diff --git a/app/build.gradle b/app/build.gradle index 5d9555c494..5412be7fa1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,7 +25,6 @@ jacoco { } ext { - supportLibraryVersion = "28.0.0" ormLiteVersion = "4.46" powermockVersion = "1.7.3" dexmakerVersion = "1.2" 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 b4dbdfa2fb..77cf60f4e7 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin +import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin @@ -84,6 +85,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang @Inject lateinit var tidepoolPlugin: TidepoolPlugin @Inject lateinit var virtualPumpPlugin: VirtualPumpPlugin @Inject lateinit var wearPlugin: WearPlugin + @Inject lateinit var maintenancePlugin: MaintenancePlugin @Inject lateinit var androidInjector: DispatchingAndroidInjector @@ -104,6 +106,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang outState.putInt("id", pluginId) } + private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?, enabled: Boolean) { + if (enabled) addPreferencesFromResourceIfEnabled(p, rootKey) + } + private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?) { if (p!!.isEnabled() && p.preferencesId != -1) addPreferencesFromResource(p.preferencesId, rootKey) @@ -117,59 +123,49 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { - if (savedInstanceState != null && savedInstanceState.containsKey("id")) { - pluginId = savedInstanceState.getInt("id") - } - if (arguments != null && arguments!!.containsKey("id")) { - pluginId = arguments!!.getInt("id") + (savedInstanceState ?: arguments)?.let { bundle -> + if (bundle.containsKey("id")) { + pluginId = bundle.getInt("id") + } } if (pluginId != -1) { addPreferencesFromResource(pluginId, rootKey) } else { - if (!Config.NSCLIENT) { - addPreferencesFromResource(R.xml.pref_password, rootKey) - } addPreferencesFromResource(R.xml.pref_general, rootKey) - addPreferencesFromResource(R.xml.pref_age, rootKey) addPreferencesFromResource(R.xml.pref_overview, rootKey) + addPreferencesFromResourceIfEnabled(safetyPlugin, rootKey) addPreferencesFromResourceIfEnabled(eversensePlugin, rootKey) addPreferencesFromResourceIfEnabled(dexcomPlugin, rootKey) addPreferencesFromResourceIfEnabled(tomatoPlugin, rootKey) addPreferencesFromResourceIfEnabled(poctechPlugin, rootKey) addPreferencesFromResourceIfEnabled(glimpPlugin, rootKey) addPreferencesFromResourceIfEnabled(careportalPlugin, rootKey) - addPreferencesFromResourceIfEnabled(safetyPlugin, rootKey) - if (Config.APS) { - addPreferencesFromResourceIfEnabled(loopPlugin, rootKey) - addPreferencesFromResourceIfEnabled(openAPSMAPlugin, rootKey) - addPreferencesFromResourceIfEnabled(openAPSAMAPlugin, rootKey) - addPreferencesFromResourceIfEnabled(openAPSSMBPlugin, rootKey) - } + addPreferencesFromResourceIfEnabled(loopPlugin, rootKey, Config.APS) + addPreferencesFromResourceIfEnabled(openAPSMAPlugin, rootKey, Config.APS) + addPreferencesFromResourceIfEnabled(openAPSAMAPlugin, rootKey, Config.APS) + addPreferencesFromResourceIfEnabled(openAPSSMBPlugin, rootKey, Config.APS) addPreferencesFromResourceIfEnabled(SensitivityAAPSPlugin.getPlugin(), rootKey) addPreferencesFromResourceIfEnabled(SensitivityWeightedAveragePlugin.getPlugin(), rootKey) addPreferencesFromResourceIfEnabled(SensitivityOref0Plugin.getPlugin(), rootKey) addPreferencesFromResourceIfEnabled(SensitivityOref1Plugin.getPlugin(), rootKey) - if (Config.PUMPDRIVERS) { - addPreferencesFromResourceIfEnabled(danaRPlugin, rootKey) - addPreferencesFromResourceIfEnabled(danaRKoreanPlugin, rootKey) - addPreferencesFromResourceIfEnabled(danaRv2Plugin, rootKey) - addPreferencesFromResourceIfEnabled(danaRSPlugin, rootKey) - addPreferencesFromResourceIfEnabled(LocalInsightPlugin.getPlugin(), rootKey) - addPreferencesFromResourceIfEnabled(ComboPlugin.getPlugin(), rootKey) - addPreferencesFromResourceIfEnabled(MedtronicPumpPlugin.getPlugin(), rootKey) - } - if (!Config.NSCLIENT) { - addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey) - } + addPreferencesFromResourceIfEnabled(danaRPlugin, rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(danaRKoreanPlugin, rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(danaRv2Plugin, rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(danaRSPlugin, rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(LocalInsightPlugin.getPlugin(), rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(ComboPlugin.getPlugin(), rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(MedtronicPumpPlugin.getPlugin(), rootKey, Config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey, !Config.NSCLIENT) addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey) addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), rootKey) addPreferencesFromResourceIfEnabled(tidepoolPlugin, rootKey) addPreferencesFromResourceIfEnabled(smsCommunicatorPlugin, rootKey) addPreferencesFromResourceIfEnabled(automationPlugin, rootKey) - addPreferencesFromResource(R.xml.pref_others, rootKey) - addPreferencesFromResource(R.xml.pref_datachoices, rootKey) addPreferencesFromResourceIfEnabled(wearPlugin, rootKey) addPreferencesFromResourceIfEnabled(statusLinePlugin, rootKey) + addPreferencesFromResource(R.xml.pref_alerts, rootKey) // TODO not organized well + addPreferencesFromResource(R.xml.pref_datachoices, rootKey) + addPreferencesFromResourceIfEnabled(maintenancePlugin, rootKey) } initSummary(preferenceScreen) for (plugin in MainApp.getPluginsList()) { diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt index 8a5f0b7d65..27c5e7d86b 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/DefaultEditTextValidator.kt @@ -21,6 +21,7 @@ class DefaultEditTextValidator : EditTextValidator { protected var customFormat: String? = null protected var emptyErrorStringActual: String? = null protected var emptyErrorStringDef: String? = null + protected var minLength = 0 protected var minNumber = 0 protected var maxNumber = 0 protected var floatminNumber = 0f @@ -43,6 +44,8 @@ class DefaultEditTextValidator : EditTextValidator { customRegexp = typedArray.getString(R.styleable.FormEditText_customRegexp) emptyErrorStringDef = typedArray.getString(R.styleable.FormEditText_emptyErrorString) customFormat = typedArray.getString(R.styleable.FormEditText_customFormat) + if (testType == EditTextValidator.TEST_MIN_LENGTH) + minLength = typedArray.getInt(R.styleable.FormEditText_minLength, 0) if (testType == EditTextValidator.TEST_NUMERIC_RANGE) { minNumber = typedArray.getInt(R.styleable.FormEditText_minNumber, Int.MIN_VALUE) maxNumber = typedArray.getInt(R.styleable.FormEditText_maxNumber, Int.MAX_VALUE) @@ -113,11 +116,14 @@ class DefaultEditTextValidator : EditTextValidator { EditTextValidator.TEST_CREDITCARD -> toAdd = CreditCardValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_creditcard_number_not_valid) else testErrorString) EditTextValidator.TEST_EMAIL -> toAdd = EmailValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_email_address_not_valid) else testErrorString) EditTextValidator.TEST_PHONE -> toAdd = PhoneValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_phone_not_valid) else testErrorString) + EditTextValidator.TEST_MULTI_PHONE -> toAdd = MultiPhoneValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_phone_not_valid) else testErrorString) EditTextValidator.TEST_DOMAINNAME -> toAdd = DomainValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_domain_not_valid) else testErrorString) EditTextValidator.TEST_IPADDRESS -> toAdd = IpAddressValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_ip_not_valid) else testErrorString) EditTextValidator.TEST_WEBURL -> toAdd = WebUrlValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_url_not_valid) else testErrorString) + EditTextValidator.TEST_HTTPS_URL -> toAdd = HttpsUrlValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_url_not_valid) else testErrorString) EditTextValidator.TEST_PERSONNAME -> toAdd = PersonNameValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_notvalid_personname) else testErrorString) EditTextValidator.TEST_PERSONFULLNAME -> toAdd = PersonFullNameValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_notvalid_personfullname) else testErrorString) + EditTextValidator.TEST_MIN_LENGTH -> toAdd = MinDigitLengthValidator(if (TextUtils.isEmpty(testErrorString)) context.getString(R.string.error_not_a_minimum_length) else testErrorString, minLength) EditTextValidator.TEST_CUSTOM -> { // must specify the fully qualified class name & an error message @@ -213,13 +219,15 @@ class DefaultEditTextValidator : EditTextValidator { } override fun showUIError() { - if (mValidator!!.hasErrorMessage()) { - try { - val parent = editTextView.parent as TextInputLayout - parent.isErrorEnabled = true - parent.error = mValidator!!.errorMessage - } catch (e: Throwable) { - editTextView.error = mValidator!!.errorMessage + mValidator?.let { mValidator -> + if (mValidator.hasErrorMessage()) { + try { + val parent = editTextView.parent as TextInputLayout + parent.isErrorEnabled = true + parent.error = mValidator.errorMessage + } catch (e: Throwable) { + editTextView.error = mValidator.errorMessage + } } } } diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/EditTextValidator.java b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/EditTextValidator.java index 3c7ae9b690..b14c4b0837 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/EditTextValidator.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/EditTextValidator.java @@ -87,4 +87,10 @@ public interface EditTextValidator { int TEST_FLOAT_NUMERIC_RANGE = 16; + int TEST_HTTPS_URL = 17; + + int TEST_MIN_LENGTH = 18; + + int TEST_MULTI_PHONE = 19; + } diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt index db959241cc..190a3bea73 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/ValidatingEditTextPreference.kt @@ -8,11 +8,10 @@ import androidx.preference.EditTextPreference.OnBindEditTextListener import androidx.preference.PreferenceViewHolder import info.nightscout.androidaps.R -class ValidatingEditTextPreference(private val ctx: Context, val attrs: AttributeSet, private val defStyleAttr: Int, private val defStyleRes: Int) +class ValidatingEditTextPreference(ctx: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : EditTextPreference(ctx, attrs, defStyleAttr, defStyleRes) { init { - dialogLayoutResource = R.layout.dialog_preference val typedArray = context.obtainStyledAttributes(attrs, R.styleable.FormEditText, 0, 0) val onBindEditTextListener = OnBindEditTextListener { editText -> editTextValidator = DefaultEditTextValidator(editText, typedArray, context) @@ -27,7 +26,7 @@ class ValidatingEditTextPreference(private val ctx: Context, val attrs: Attribut : this(ctx, attrs, TypedArrayUtils.getAttr(ctx, R.attr.editTextPreferenceStyle, R.attr.editTextPreferenceStyle)) - lateinit var editTextValidator: EditTextValidator + private lateinit var editTextValidator: EditTextValidator override fun onBindViewHolder(holder: PreferenceViewHolder?) { super.onBindViewHolder(holder) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/HttpsUrlValidator.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/HttpsUrlValidator.kt new file mode 100644 index 0000000000..947ad9cd6c --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/HttpsUrlValidator.kt @@ -0,0 +1,9 @@ +package info.nightscout.androidaps.utils.textValidator.validators + +import android.widget.EditText + +class HttpsUrlValidator(_customErrorMessage: String?) : WebUrlValidator(_customErrorMessage) { + + override fun isValid(editText: EditText): Boolean = + super.isValid(editText) && editText.text.startsWith("https://", ignoreCase = true) +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MinDigitLengthValidator.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MinDigitLengthValidator.kt new file mode 100644 index 0000000000..0042e6ada8 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MinDigitLengthValidator.kt @@ -0,0 +1,12 @@ +package info.nightscout.androidaps.utils.textValidator.validators + +import android.widget.EditText + +class MinDigitLengthValidator(message: String?, private val min: Int) : Validator(message) { + + override fun isValid(editText: EditText): Boolean { + val length = editText.text.toString().length + return length >= min + } + +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MultiPhoneValidator.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MultiPhoneValidator.kt new file mode 100644 index 0000000000..3baba5240d --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/MultiPhoneValidator.kt @@ -0,0 +1,16 @@ +package info.nightscout.androidaps.utils.textValidator.validators + +import android.util.Patterns +import android.widget.EditText + +class MultiPhoneValidator(val _customErrorMessage: String?) : Validator(_customErrorMessage) { + + override fun isValid(editText: EditText): Boolean { + val substrings = editText.text.split(";").toTypedArray() + for (number in substrings) { + if (!PatternValidator(_customErrorMessage, Patterns.PHONE).isValid(number)) + return false + } + return substrings.isNotEmpty() + } +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PatternValidator.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PatternValidator.kt index bd4cf1f4b2..58685555be 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PatternValidator.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/PatternValidator.kt @@ -24,4 +24,8 @@ open class PatternValidator(_customErrorMessage: String?, val pattern: Pattern) override fun isValid(editText: EditText): Boolean { return pattern.matcher(editText.text).matches() } + + fun isValid(text: String): Boolean { + return pattern.matcher(text).matches() + } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/WebUrlValidator.kt b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/WebUrlValidator.kt index 51d0c540e4..bc1312df1b 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/WebUrlValidator.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/textValidator/validators/WebUrlValidator.kt @@ -8,4 +8,4 @@ import android.util.Patterns * * @author Andrea Baccega @andreabaccega.com> */ -class WebUrlValidator(_customErrorMessage: String?) : PatternValidator(_customErrorMessage, Patterns.WEB_URL) \ No newline at end of file +open class WebUrlValidator(_customErrorMessage: String?) : PatternValidator(_customErrorMessage, Patterns.WEB_URL) \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_preference.xml b/app/src/main/res/layout/dialog_preference.xml deleted file mode 100644 index 4de4f97e4b..0000000000 --- a/app/src/main/res/layout/dialog_preference.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/fet_attrs.xml b/app/src/main/res/values/fet_attrs.xml index 32c297be52..855baef5b1 100644 --- a/app/src/main/res/values/fet_attrs.xml +++ b/app/src/main/res/values/fet_attrs.xml @@ -20,6 +20,9 @@ + + + @@ -27,6 +30,7 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d05b4fc86..0f576f13a3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1141,7 +1141,7 @@ Attention: If you activate and connect to a hardware pump, AndroidAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AndroidAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time. Treatment data incomplete Maintenance Settings - Email + Email recipient maintenance_logs_email maintenance_logs_amount logshipper_amount @@ -1687,5 +1687,6 @@ snooze_dst_in24h snooze_loopdisabled enable_fabric + ^\\d{6} diff --git a/app/src/main/res/values/validator.xml b/app/src/main/res/values/validator.xml index 3dc8999bb6..cc05a05625 100644 --- a/app/src/main/res/values/validator.xml +++ b/app/src/main/res/values/validator.xml @@ -14,4 +14,10 @@ Not a valid first or last name. Not a valid full name. Format not valid + Must be 4 digit number + Must be 6 digit number + Not a minimum length + + ^\\d{4} + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_absorption_aaps.xml b/app/src/main/res/xml/pref_absorption_aaps.xml index 22560c2448..7cc14ebb21 100644 --- a/app/src/main/res/xml/pref_absorption_aaps.xml +++ b/app/src/main/res/xml/pref_absorption_aaps.xml @@ -1,10 +1,12 @@ - + + android:title="@string/absorptionsettings_title" + app:initialExpandedChildrenCount="0"> - + + android:title="@string/absorptionsettings_title" + app:initialExpandedChildrenCount="0"> - - + + android:title="@string/absorptionsettings_title" + app:initialExpandedChildrenCount="0"> - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/xml/pref_alerts.xml b/app/src/main/res/xml/pref_alerts.xml new file mode 100644 index 0000000000..1a81cefc66 --- /dev/null +++ b/app/src/main/res/xml/pref_alerts.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/pref_automation.xml b/app/src/main/res/xml/pref_automation.xml index d835ebbc94..e1c43f32b4 100644 --- a/app/src/main/res/xml/pref_automation.xml +++ b/app/src/main/res/xml/pref_automation.xml @@ -1,7 +1,10 @@ - + - + - + + + android:title="@string/bgsource_upload" + app:initialExpandedChildrenCount="0"> - + + + android:title="@string/bgsource_upload" + app:initialExpandedChildrenCount="0"> - + + android:title="@string/danar_pump_settings" + app:initialExpandedChildrenCount="0"> - + android:title="@string/danar_password_title" + validate:customRegexp="@string/fourdigitnumber" + validate:testErrorString="@string/error_mustbe4digitnumber" + validate:testType="regexp" /> - + - + + android:title="@string/danar_pump_settings" + app:initialExpandedChildrenCount="0"> - + android:title="@string/danar_password_title" + validate:customRegexp="@string/fourdigitnumber" + validate:testErrorString="@string/error_mustbe4digitnumber" + validate:testType="regexp" /> - + - + - + android:title="@string/danar_password_title" + validate:customRegexp="@string/fourdigitnumber" + validate:testErrorString="@string/error_mustbe4digitnumber" + validate:testType="regexp" /> - + + android:title="@string/danar_pump_settings" + app:initialExpandedChildrenCount="0"> - + android:title="@string/danar_password_title" + validate:customRegexp="@string/fourdigitnumber" + validate:testErrorString="@string/error_mustbe4digitnumber" + validate:testType="regexp" /> - + + + android:title="@string/data_choices" + app:initialExpandedChildrenCount="0"> - - - - - - - - - + diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index 6c87ba4f78..b68aa33c21 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -1,22 +1,29 @@ - + + android:key="@string/key_units" + android:title="@string/unitsnosemicolon" /> + android:key="@string/key_language" + android:title="@string/language" /> + + diff --git a/app/src/main/res/xml/pref_insight_local_full.xml b/app/src/main/res/xml/pref_insight_local_full.xml index ac0bb6cff6..ceaba15e38 100644 --- a/app/src/main/res/xml/pref_insight_local_full.xml +++ b/app/src/main/res/xml/pref_insight_local_full.xml @@ -1,6 +1,10 @@ - - + + + + + diff --git a/app/src/main/res/xml/pref_insight_local_pumpcontrol.xml b/app/src/main/res/xml/pref_insight_local_pumpcontrol.xml index 2a37c2fabd..780ba686a2 100644 --- a/app/src/main/res/xml/pref_insight_local_pumpcontrol.xml +++ b/app/src/main/res/xml/pref_insight_local_pumpcontrol.xml @@ -1,6 +1,10 @@ - - + + + + + diff --git a/app/src/main/res/xml/pref_insulinoreffreepeak.xml b/app/src/main/res/xml/pref_insulinoreffreepeak.xml index 63c21d1050..5b7b290ae0 100644 --- a/app/src/main/res/xml/pref_insulinoreffreepeak.xml +++ b/app/src/main/res/xml/pref_insulinoreffreepeak.xml @@ -1,21 +1,24 @@ + + android:title="@string/insulin_oref_peak" + app:initialExpandedChildrenCount="0"> + validate:maxNumber="120" + validate:minNumber="35" + validate:testType="numericRange" /> + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_loop.xml b/app/src/main/res/xml/pref_loop.xml index b9ad9c9763..0d92a6bc5f 100644 --- a/app/src/main/res/xml/pref_loop.xml +++ b/app/src/main/res/xml/pref_loop.xml @@ -1,17 +1,18 @@ + android:entryValues="@array/aps_modeValues" + android:key="@string/key_aps_mode" + android:title="@string/apsmode_title" /> + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_maintenance.xml b/app/src/main/res/xml/pref_maintenance.xml index f97cbe96f6..fe1397d2b9 100644 --- a/app/src/main/res/xml/pref_maintenance.xml +++ b/app/src/main/res/xml/pref_maintenance.xml @@ -1,9 +1,12 @@ - + + android:title="@string/maintenance_settings" + app:initialExpandedChildrenCount="0"> + android:title="@string/maintenance_email" + validate:testType="email"/> - - - - - + android:title="@string/maintenance_amount" + validate:maxNumber="10" + validate:minNumber="1" + validate:testType="numericRange"/> diff --git a/app/src/main/res/xml/pref_medtronic.xml b/app/src/main/res/xml/pref_medtronic.xml index 74c42a3803..0d6349489b 100644 --- a/app/src/main/res/xml/pref_medtronic.xml +++ b/app/src/main/res/xml/pref_medtronic.xml @@ -1,14 +1,22 @@ - - + + + android:title="@string/medtronic_serial_number" + validate:customRegexp="@string/sixdigitnumber" + validate:testErrorString="@string/error_mustbe6digitnumber" + validate:testType="regexp" /> + + android:title="@string/medtronic_pump_max_basal" + validate:maxNumber="35" + validate:minNumber="1" + validate:testType="numericRange" /> + android:title="@string/medtronic_pump_max_bolus" + validate:maxNumber="25" + validate:minNumber="1" + validate:testType="numericRange" /> + android:title="RileyLink Configuration"> + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_nsclientinternal.xml b/app/src/main/res/xml/pref_nsclientinternal.xml index 3ef4fe8556..e6369bb199 100644 --- a/app/src/main/res/xml/pref_nsclientinternal.xml +++ b/app/src/main/res/xml/pref_nsclientinternal.xml @@ -1,8 +1,11 @@ - + + validate:testType="httpsUrl" /> - + android:title="@string/nsclientinternal_secret_title" + validate:minLength="12" + validate:testType="minLength"/> + android:title="@string/ns_logappstartedevent" + android:summary="@string/ns_logappstartedevent" + /> - + + android:summary="@string/ns_autobackfill_summary" + android:title="@string/ns_autobackfill_title" /> - - + + + android:title="@string/openapsma_maxbasal_title" + validate:floatmaxNumber="12.0" + validate:floatminNumber="0.1" + validate:testType="floatNumericRange" /> - + android:title="@string/openapsma_maxiob_title" + validate:floatmaxNumber="12.0" + validate:floatminNumber="0" + validate:testType="floatNumericRange" /> + android:title="@string/openapsma" + app:initialExpandedChildrenCount="0"> - + android:title="@string/openapsma_maxbasal_title" + validate:floatmaxNumber="12.0" + validate:floatminNumber="0.1" + validate:testType="floatNumericRange" /> - + android:title="@string/openapsma_maxiob_title" + validate:floatmaxNumber="12.0" + validate:floatminNumber="0" + validate:testType="floatNumericRange" /> + diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml index 867b6bb2fc..0cecf93c73 100644 --- a/app/src/main/res/xml/pref_openapssmb.xml +++ b/app/src/main/res/xml/pref_openapssmb.xml @@ -1,23 +1,31 @@ + - + android:title="@string/openapsma_maxbasal_title" + validate:floatmaxNumber="12.0" + validate:floatminNumber="0.1" + validate:testType="floatNumericRange" /> - + + android:title="@string/high_temptarget_raises_sensitivity_title" /> + android:title="@string/low_temptarget_lowers_sensitivity_title" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/xml/pref_overview.xml b/app/src/main/res/xml/pref_overview.xml index be6a85b727..1e4825f113 100644 --- a/app/src/main/res/xml/pref_overview.xml +++ b/app/src/main/res/xml/pref_overview.xml @@ -1,14 +1,17 @@ - + + android:summary="@string/keep_screen_on_summary" + android:title="@string/keep_screen_on_title" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/xml/pref_safety.xml b/app/src/main/res/xml/pref_safety.xml index e44b419b57..e3f5f2e23d 100644 --- a/app/src/main/res/xml/pref_safety.xml +++ b/app/src/main/res/xml/pref_safety.xml @@ -1,20 +1,39 @@ - + + + android:title="@string/treatmentssafety_title" + app:initialExpandedChildrenCount="0"> + + - + android:inputType="numberDecimal" + android:key="@string/key_treatmentssafety_maxbolus" + android:title="@string/treatmentssafety_maxbolus_title" + validate:floatmaxNumber="25.0" + validate:floatminNumber="0.1" + validate:testType="floatNumericRange" /> + + - + android:inputType="numberDecimal" + android:key="@string/key_treatmentssafety_maxcarbs" + android:title="@string/treatmentssafety_maxcarbs_title" + validate:floatmaxNumber="200" + validate:floatminNumber="1" + validate:testType="numericRange" /> + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_smscommunicator.xml b/app/src/main/res/xml/pref_smscommunicator.xml index eccbcae6f9..1ac0971a42 100644 --- a/app/src/main/res/xml/pref_smscommunicator.xml +++ b/app/src/main/res/xml/pref_smscommunicator.xml @@ -1,29 +1,32 @@ - - + + - + android:title="@string/smscommunicator_allowednumbers" + validate:testType="multiPhone" /> + + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_tidepool.xml b/app/src/main/res/xml/pref_tidepool.xml index cf0d7137d4..96e3c8f218 100644 --- a/app/src/main/res/xml/pref_tidepool.xml +++ b/app/src/main/res/xml/pref_tidepool.xml @@ -1,53 +1,66 @@ - + + android:title="@string/tidepool" + app:initialExpandedChildrenCount="0"> - + android:title="@string/title_tidepool_username" + validate:testType="email"/> + + + + + + + + + + - - + - + + + + - \ No newline at end of file diff --git a/app/src/main/res/xml/pref_wear.xml b/app/src/main/res/xml/pref_wear.xml index f112332190..a18d77061b 100644 --- a/app/src/main/res/xml/pref_wear.xml +++ b/app/src/main/res/xml/pref_wear.xml @@ -1,97 +1,102 @@ - - + - + + + + + + + + + + + + + + + + + + + + + + android:key="@string/key_wear_detailediob" + android:summary="@string/wear_detailedIOB_summary" + android:title="@string/wear_detailedIOB_title" /> - + - + + - + - + - + - + - - - - - - - - - - - - - - - + diff --git a/app/src/main/res/xml/pref_xdripstatus.xml b/app/src/main/res/xml/pref_xdripstatus.xml index 07796b9b6d..00aa8262ef 100644 --- a/app/src/main/res/xml/pref_xdripstatus.xml +++ b/app/src/main/res/xml/pref_xdripstatus.xml @@ -1,19 +1,23 @@ - + + + android:title="@string/xdripstatus_settings" + app:initialExpandedChildrenCount="0"> + android:summary="@string/wear_detailedIOB_summary" + android:title="@string/wear_detailedIOB_title" /> + + android:summary="@string/wear_showbgi_summary" + android:title="@string/wear_showbgi_title" /> + \ No newline at end of file