From 52ec377adeb61183d745fa6aaf21b180705e1608 Mon Sep 17 00:00:00 2001 From: Mugurell Date: Tue, 17 Sep 2024 12:15:17 +0000 Subject: [PATCH] Bug 1919200 - Restore the toolbar background after the microsurvey is dismissed r=android-reviewers,twhite Use `isMicrosurveyPromptDismissed.value` to know when either of the survey prompt or survey options dialog was closed. Reapplying the default background when the survey is closed will mean a small divider line included in the background shape will also be shown. Differential Revision: https://phabricator.services.mozilla.com/D222423 --- .../mozilla/fenix/browser/BaseBrowserFragment.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 0237fd51a9e8..6c0b9f28a24f 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -1541,6 +1541,8 @@ abstract class BaseBrowserFragment : }, ) } + } else { + restoreBrowserToolbarAfterMicrosurveyPrompt(browserToolbar) } if (isToolbarAtBottom) { @@ -1744,6 +1746,7 @@ abstract class BaseBrowserFragment : } } + @Suppress("LongMethod") private fun initializeMicrosurveyPrompt() { val context = requireContext() val view = requireView() @@ -1799,6 +1802,8 @@ abstract class BaseBrowserFragment : }, ) } + } else { + restoreBrowserToolbarAfterMicrosurveyPrompt(browserToolbar) } if (isToolbarAtBottom) { @@ -1844,6 +1849,15 @@ abstract class BaseBrowserFragment : browserToolbar.elevation = 0.0f } + private fun restoreBrowserToolbarAfterMicrosurveyPrompt(browserToolbar: BrowserToolbar) { + val defaultBackground = ResourcesCompat.getDrawable( + resources, + R.drawable.toolbar_background, + context?.theme, + ) + browserToolbar.background = defaultBackground + } + private var currentMicrosurvey: MicrosurveyUIData? = null /**