1
0
Fork 0

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

master
Sawyer Blatz 2020-03-12 09:54:13 -07:00 committed by GitHub
parent 9a582a6983
commit cc8f34b68b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -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()
}

View File

@ -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,

View File

@ -81,6 +81,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
bookmarkStore = StoreProvider.get(this) {
BookmarkFragmentStore(BookmarkFragmentState(null))
}
bookmarkInteractor = BookmarkFragmentInteractor(
bookmarkStore = bookmarkStore,
viewModel = sharedViewModel,