2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] Show undo snackbars with padding with static bottom toolbar

This specifically fixes the close tab snackbar.  This commit mirrors
the logic when not using Undo from
e14bf8e791aa56ded47812018f32ee9801a5b4f9.  References https://github.com/mozilla-mobile/fenix/issues/14982.
This commit is contained in:
Andrew Gaul 2020-09-24 19:39:22 +09:00 committed by Sebastian Kaspari
parent 1429c5ddaf
commit 43778cf3cb
2 changed files with 4 additions and 1 deletions

View File

@ -275,6 +275,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
{
requireComponents.useCases.tabsUseCases.undo.invoke()
},
paddedForBottomToolbar = true,
operation = { }
)
}

View File

@ -60,6 +60,7 @@ fun CoroutineScope.allowUndo(
// writing a volatile variable.
val requestedUndo = AtomicBoolean(false)
@Suppress("ComplexCondition")
fun showUndoSnackbar() {
val snackbar = FenixSnackbar
.make(
@ -82,6 +83,7 @@ fun CoroutineScope.allowUndo(
val shouldUseBottomToolbar = view.context.settings().shouldUseBottomToolbar
val toolbarHeight = view.resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
val dynamicToolbarEnabled = view.context.settings().isDynamicToolbarEnabled
snackbar.view.updatePadding(
bottom = if (
@ -92,7 +94,7 @@ fun CoroutineScope.allowUndo(
// can't intelligently position the snackbar on the upper most view.
// Ideally we should not pass ContentFrameLayout in, but it's the only
// way to display snackbars through a fragment transition.
view is ContentFrameLayout
(view is ContentFrameLayout || !dynamicToolbarEnabled)
) {
toolbarHeight
} else {