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
This commit is contained in:
Mugurell 2024-09-17 12:15:17 +00:00
parent 90e93d430d
commit 52ec377ade

View File

@ -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
/**