From 122ae15a6f7d657c240070c02b08e7abb27cd88d Mon Sep 17 00:00:00 2001 From: osodebailar Date: Tue, 22 Mar 2022 10:19:09 +0100 Subject: [PATCH] fix plugin preference back button --- app/src/main/AndroidManifest.xml | 3 +-- .../androidaps/activities/PreferencesActivity.kt | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 54c7295df1..4f40d65323 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -63,8 +63,7 @@ - + diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt index 0b87fb461e..ed149949a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt @@ -4,6 +4,7 @@ import android.content.Context import android.os.Bundle import android.text.Editable import android.text.TextWatcher +import android.view.MenuItem import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceScreen import info.nightscout.androidaps.R @@ -62,4 +63,14 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa private fun filterPreferences() { myPreferenceFragment?.setFilter(binding.prefFilter.text.toString()) } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.getItemId()) { + android.R.id.home -> { + onBackPressed() + return true + } + } + return super.onOptionsItemSelected(item) + } } \ No newline at end of file