Unverified Commit cc8f34b6 authored by Sawyer Blatz's avatar Sawyer Blatz Committed by GitHub
Browse files

For #8773: Fixes issue with snackbar placement on ContextMenu (#8942)

parent 9a582a69
......@@ -19,12 +19,12 @@ class FenixSnackbarDelegate(val view: View) :
listener: ((v: View) -> Unit)?
) {
if (listener != null && action != 0) {
FenixSnackbar.makeWithToolbarPadding(view)
FenixSnackbar.make(view, duration = FenixSnackbar.LENGTH_SHORT)
.setText(view.context.getString(text))
.setAction(view.context.getString(action)) { listener.invoke(view) }
.show()
} else {
FenixSnackbar.makeWithToolbarPadding(view)
FenixSnackbar.make(view, duration = FenixSnackbar.LENGTH_SHORT)
.setText(view.context.getString(text))
.show()
}
......
......@@ -110,18 +110,19 @@ class FenixSnackbar private constructor(
}
/**
* Considers BrowserToolbar for padding when making snackbar
* Considers BrowserToolbar for padding when making snackbar. The vast majority of the time
* you will want to pass in `fragment.view`.
*/
fun makeWithToolbarPadding(
view: View,
fragmentView: View,
duration: Int = LENGTH_LONG,
isError: Boolean = false
): FenixSnackbar {
val shouldUseBottomToolbar = view.context.settings().shouldUseBottomToolbar
val toolbarHeight = view.context.resources
val shouldUseBottomToolbar = fragmentView.context.settings().shouldUseBottomToolbar
val toolbarHeight = fragmentView.context.resources
.getDimensionPixelSize(R.dimen.browser_toolbar_height)
return make(view, duration, isError).apply {
return make(fragmentView, duration, isError).apply {
this.view.setPadding(
0,
0,
......
......@@ -81,6 +81,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
bookmarkStore = StoreProvider.get(this) {
BookmarkFragmentStore(BookmarkFragmentState(null))
}
bookmarkInteractor = BookmarkFragmentInteractor(
bookmarkStore = bookmarkStore,
viewModel = sharedViewModel,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment