1
0
Fork 0

Switch to onBackPressedDispatcher for navigating back

onBackPressed() method has been deprecated

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2024-09-19 11:24:16 +05:30
parent 39f4df70ce
commit 70406d40ea
3 changed files with 3 additions and 3 deletions
app/src/main/java/com/stevesoltys/seedvault/ui
storage/demo/src/main/java/de/grobox/storagebackuptester/restore

View file

@ -23,7 +23,7 @@ abstract class BackupActivity : AppCompatActivity() {
@CallSuper
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
android.R.id.home -> {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
true
}
else -> super.onOptionsItemSelected(item)

View file

@ -45,7 +45,7 @@ class RecoveryCodeActivity : BackupActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
true
}
else -> super.onOptionsItemSelected(item)

View file

@ -31,7 +31,7 @@ class DemoSnapshotFragment : SnapshotFragment() {
bottomStub.layoutResource = R.layout.footer_snapshot
val footer = bottomStub.inflate()
footer.findViewById<Button>(R.id.button).setOnClickListener {
requireActivity().onBackPressed()
requireActivity().onBackPressedDispatcher.onBackPressed()
}
return v
}