From 25f87b314906cfae18b9422d978658913430f270 Mon Sep 17 00:00:00 2001 From: t-p-white Date: Tue, 22 Aug 2023 12:37:25 +0100 Subject: [PATCH] Bug 1823316 - Use 'Snackbar' themed Dialog to notify on making app full-screen --- .../fenix/browser/BaseBrowserFragment.kt | 10 +++-- .../full_screen_notification_dialog.xml | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/layout/full_screen_notification_dialog.xml diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 03e1b6b83..f810667c4 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -17,7 +17,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityManager -import android.widget.Toast import androidx.activity.result.ActivityResultLauncher import androidx.annotation.CallSuper import androidx.annotation.VisibleForTesting @@ -76,6 +75,7 @@ import mozilla.components.feature.prompts.PromptFeature import mozilla.components.feature.prompts.PromptFeature.Companion.PIN_REQUEST import mozilla.components.feature.prompts.address.AddressDelegate import mozilla.components.feature.prompts.creditcard.CreditCardDelegate +import mozilla.components.feature.prompts.dialog.FullScreenNotificationDialog import mozilla.components.feature.prompts.identitycredential.DialogColors import mozilla.components.feature.prompts.identitycredential.DialogColorsProvider import mozilla.components.feature.prompts.login.LoginDelegate @@ -1493,9 +1493,11 @@ abstract class BaseBrowserFragment : if (inFullScreen) { // Close find in page bar if opened findInPageIntegration.onBackPressed() - Toast - .makeText(requireContext(), R.string.full_screen_notification, Toast.LENGTH_SHORT) - .show() + + FullScreenNotificationDialog(R.layout.full_screen_notification_dialog).show( + parentFragmentManager, + ) + activity?.enterImmersiveMode() (view as? SwipeGestureLayout)?.isSwipeEnabled = false browserToolbarView.collapse() diff --git a/app/src/main/res/layout/full_screen_notification_dialog.xml b/app/src/main/res/layout/full_screen_notification_dialog.xml new file mode 100644 index 000000000..6bc78ae7e --- /dev/null +++ b/app/src/main/res/layout/full_screen_notification_dialog.xml @@ -0,0 +1,40 @@ + + + + + + + +