diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt index 04c6167f12..b12bc67b9b 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -117,8 +117,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { // profile context?.let { context -> - val profileStore = activePlugin.activeProfileSource.profile - ?: return + val profileStore = activePlugin.activeProfileSource.profile ?: return val profileListToCheck = profileStore.getProfileList() val profileList = ArrayList() for (profileName in profileListToCheck) { @@ -130,15 +129,16 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { dismiss() return } - val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList) - binding.profile.adapter = adapter + binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList)) // set selected to actual profile if (profileIndex != null) - binding.profile.setSelection(profileIndex as Int) - else + binding.profileList.setText(profileList[profileIndex as Int], false) + else { + binding.profileList.setText(profileList[0], false) for (p in profileList.indices) if (profileList[p] == profileFunction.getOriginalProfileName()) - binding.profile.setSelection(p) + binding.profileList.setText(profileList[p], false) + } } profileFunction.getProfile()?.let { profile -> @@ -173,7 +173,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { val duration = binding.duration.value.toInt() if (duration > 0L) actions.add(rh.gs(R.string.duration) + ": " + rh.gs(R.string.format_mins, duration)) - val profileName = binding.profile.selectedItem.toString() + val profileName = binding.profileList.text.toString() actions.add(rh.gs(R.string.profile) + ": " + profileName) val percent = binding.percentage.value.toInt() if (percent != 100) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt index 8eaf29a08c..1f2867d5cc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt @@ -128,12 +128,12 @@ class OverviewData @Inject constructor( var lastBg: GlucoseValue? = null - val isLow: Boolean + private val isLow: Boolean get() = lastBg?.let { lastBg -> lastBg.valueToUnits(profileFunction.getUnits()) < defaultValueHelper.determineLowLine() } ?: false - val isHigh: Boolean + private val isHigh: Boolean get() = lastBg?.let { lastBg -> lastBg.valueToUnits(profileFunction.getUnits()) > defaultValueHelper.determineHighLine() } ?: false diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt index 4888f2e96c..ce79ba80e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt @@ -58,7 +58,6 @@ class LocalProfileFragment : DaggerFragment() { private var disposable: CompositeDisposable = CompositeDisposable() private var basalView: TimeListEdit? = null -// private var spinner: SpinnerHelper? = null private val save = Runnable { doEdit() @@ -240,7 +239,6 @@ class LocalProfileFragment : DaggerFragment() { ) } - // Spinner context?.let { context -> val profileList: ArrayList = localProfilePlugin.profile?.getProfileList() ?: ArrayList() binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList)) diff --git a/app/src/main/res/layout/dialog_profileswitch.xml b/app/src/main/res/layout/dialog_profileswitch.xml index 7a24040bd5..28794ebff2 100644 --- a/app/src/main/res/layout/dialog_profileswitch.xml +++ b/app/src/main/res/layout/dialog_profileswitch.xml @@ -48,29 +48,25 @@ android:orientation="horizontal" android:padding="5dp" /> - + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + android:hint="@string/profile" + app:boxStrokeColor="@color/list_delimiter"> - + android:clickable="true" + android:enabled="false" + tools:ignore="KeyboardInaccessibleWidget" /> - + -