diff --git a/app/src/main/java/org/mozilla/fenix/utils/Undo.kt b/app/src/main/java/org/mozilla/fenix/utils/Undo.kt index cb6fb9b1b..e06f61714 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Undo.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Undo.kt @@ -6,13 +6,10 @@ package org.mozilla.fenix.utils import android.content.Context import android.view.View -import androidx.appcompat.widget.ContentFrameLayout -import androidx.core.view.updatePadding import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import org.mozilla.fenix.R import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.ext.settings import java.util.concurrent.atomic.AtomicBoolean @@ -66,7 +63,7 @@ fun CoroutineScope.allowUndo( .make( view = view, duration = FenixSnackbar.LENGTH_INDEFINITE, - isDisplayedWithBrowserToolbar = false, + isDisplayedWithBrowserToolbar = paddedForBottomToolbar, ) .setText(message) .setAnchorView(anchorView) @@ -81,27 +78,6 @@ fun CoroutineScope.allowUndo( snackbar.view.elevation = it } - 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 ( - paddedForBottomToolbar && - shouldUseBottomToolbar && - // If the view passed in is a ContentFrameLayout, it does not matter - // if the user has a dynamicBottomToolbar or not, as the Android system - // 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 || !dynamicToolbarEnabled) - ) { - toolbarHeight - } else { - 0 - }, - ) - snackbar.show() // Wait a bit, and if user didn't request cancellation, proceed with