mirror of
https://github.com/home-assistant/android
synced 2024-09-06 17:23:32 +00:00
Fix top button back stack of settings activity (#802)
* Fix back stack of settings activity * Remove overwrite of onBackPressed because not using super * Fix lint
This commit is contained in:
parent
1fdb9e062a
commit
7844360760
|
@ -3,6 +3,7 @@ package io.homeassistant.companion.android.settings
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
|
@ -34,6 +35,20 @@ class SettingsActivity : AppCompatActivity(),
|
|||
.commit()
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
if (supportFragmentManager.backStackEntryCount > 0) {
|
||||
supportFragmentManager.popBackStack()
|
||||
} else {
|
||||
onBackPressed()
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPreferenceDisplayDialog(caller: PreferenceFragmentCompat, pref: Preference): Boolean {
|
||||
if (pref is SsidPreference) {
|
||||
val ssidDialog = SsidDialogFragment.newInstance("connection_internal_ssids")
|
||||
|
|
Loading…
Reference in a new issue