From 70abc8d5988f0d6e9c9479d6527159f640ac76d1 Mon Sep 17 00:00:00 2001 From: mcarare <48995920+mcarare@users.noreply.github.com> Date: Thu, 31 Aug 2023 15:31:39 +0300 Subject: [PATCH] Handle onBackPressed() deprecation. --- .../main/java/org/mozilla/reference/browser/BrowserActivity.kt | 2 +- .../reference/browser/addons/WebExtensionActionPopupActivity.kt | 2 +- .../org/mozilla/reference/browser/settings/SettingsActivity.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/mozilla/reference/browser/BrowserActivity.kt b/app/src/main/java/org/mozilla/reference/browser/BrowserActivity.kt index 7fb3b7807..178a10efa 100644 --- a/app/src/main/java/org/mozilla/reference/browser/BrowserActivity.kt +++ b/app/src/main/java/org/mozilla/reference/browser/BrowserActivity.kt @@ -85,7 +85,7 @@ open class BrowserActivity : AppCompatActivity() { } } - super.onBackPressed() + super.onBackPressedDispatcher.onBackPressed() removeSessionIfNeeded() } diff --git a/app/src/main/java/org/mozilla/reference/browser/addons/WebExtensionActionPopupActivity.kt b/app/src/main/java/org/mozilla/reference/browser/addons/WebExtensionActionPopupActivity.kt index 051603da6..6be53ab4e 100644 --- a/app/src/main/java/org/mozilla/reference/browser/addons/WebExtensionActionPopupActivity.kt +++ b/app/src/main/java/org/mozilla/reference/browser/addons/WebExtensionActionPopupActivity.kt @@ -98,7 +98,7 @@ class WebExtensionActionPopupActivity : AppCompatActivity() { override fun onWindowRequest(windowRequest: WindowRequest) { if (windowRequest.type == WindowRequest.Type.CLOSE) { - activity?.onBackPressed() + activity?.onBackPressedDispatcher?.onBackPressed() } } diff --git a/app/src/main/java/org/mozilla/reference/browser/settings/SettingsActivity.kt b/app/src/main/java/org/mozilla/reference/browser/settings/SettingsActivity.kt index cfb12b256..2d30e65ce 100644 --- a/app/src/main/java/org/mozilla/reference/browser/settings/SettingsActivity.kt +++ b/app/src/main/java/org/mozilla/reference/browser/settings/SettingsActivity.kt @@ -40,7 +40,7 @@ class SettingsActivity : AppCompatActivity(), SettingsFragment.ActionBarUpdater if (it is UserInteractionHandler && it.onBackPressed()) { return } else { - super.onBackPressed() + super.onBackPressedDispatcher.onBackPressed() } } }