summaryrefslogtreecommitdiffstats
path: root/src/android
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-05-23 02:03:18 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:06:03 +0200
commit7812de4adeb9530fa5591d3d6e42cd610e5231cc (patch)
tree5895d5cbd5cd119b1c2c6206aa78dda2ea39785a /src/android
parentandroid: Add option for touch overlay haptics (diff)
downloadyuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.tar
yuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.tar.gz
yuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.tar.bz2
yuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.tar.lz
yuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.tar.xz
yuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.tar.zst
yuzu-7812de4adeb9530fa5591d3d6e42cd610e5231cc.zip
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt
index 5c6f7eec5..783122860 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt
@@ -15,6 +15,7 @@ import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import android.view.ViewGroup.MarginLayoutParams
+import androidx.activity.OnBackPressedCallback
import androidx.core.view.updatePadding
import com.google.android.material.color.MaterialColors
import org.yuzu.yuzu_emu.NativeLibrary
@@ -70,14 +71,28 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
)
}
+ onBackPressedDispatcher.addCallback(
+ this,
+ object : OnBackPressedCallback(true) {
+ override fun handleOnBackPressed() = navigateBack()
+ })
+
setInsets()
}
override fun onSupportNavigateUp(): Boolean {
- onBackPressed()
+ navigateBack()
return true
}
+ private fun navigateBack() {
+ if (supportFragmentManager.backStackEntryCount > 0) {
+ supportFragmentManager.popBackStack()
+ } else {
+ finish()
+ }
+ }
+
override fun onCreateOptionsMenu(menu: Menu): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.menu_settings, menu)