Switch to onBackPressedDispatcher for navigating back
onBackPressed() method has been deprecated Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
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
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue