From a241a23c99883826316ff66fb403fffb4533bfe7 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 13 May 2020 23:28:07 +0200 Subject: [PATCH] fix pref parsing --- .../androidaps/activities/MyPreferenceFragment.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 0af1782c90..1d8740f631 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -238,11 +238,9 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang resourceHelper.gs(R.string.key_high_mark), resourceHelper.gs(R.string.key_low_mark) ) - if (listOf(*unitDependent).contains(pref.key)) { - val editTextPref = pref as EditTextPreference - val converted = Profile.toCurrentUnitsString(profileFunction, SafeParse.stringToDouble(editTextPref.text)) - editTextPref.summary = converted - editTextPref.text = converted + if (unitDependent.toList().contains(pref.key) && pref is EditTextPreference) { + val converted = Profile.toCurrentUnits(profileFunction, SafeParse.stringToDouble(pref.text)) + pref.summary = converted.toString() } }