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
|
|
@ -23,7 +23,7 @@ abstract class BackupActivity : AppCompatActivity() {
|
||||||
@CallSuper
|
@CallSuper
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
onBackPressed()
|
onBackPressedDispatcher.onBackPressed()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
else -> super.onOptionsItemSelected(item)
|
else -> super.onOptionsItemSelected(item)
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class RecoveryCodeActivity : BackupActivity() {
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
onBackPressed()
|
onBackPressedDispatcher.onBackPressed()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
else -> super.onOptionsItemSelected(item)
|
else -> super.onOptionsItemSelected(item)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class DemoSnapshotFragment : SnapshotFragment() {
|
||||||
bottomStub.layoutResource = R.layout.footer_snapshot
|
bottomStub.layoutResource = R.layout.footer_snapshot
|
||||||
val footer = bottomStub.inflate()
|
val footer = bottomStub.inflate()
|
||||||
footer.findViewById<Button>(R.id.button).setOnClickListener {
|
footer.findViewById<Button>(R.id.button).setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressedDispatcher.onBackPressed()
|
||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue