Merge pull request #1482 from osodebailar/fix/plugin-preference-back-button

fix plugin preference back button
This commit is contained in:
Milos Kozak 2022-03-22 10:36:29 +01:00 committed by GitHub
commit bb98586055
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -63,8 +63,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.PreferencesActivity"
android:theme="@style/AppTheme" />
<activity android:name=".activities.PreferencesActivity" />
<activity android:name=".plugins.general.overview.activities.QuickWizardListActivity"
android:theme="@style/AppTheme"
android:exported="false">

View file

@ -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)
}
}