For #2931: Show browser snackbar above quick action sheet
parent
5e0771a6f0
commit
9e0e5d95d9
|
@ -430,11 +430,15 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
||||||
is SearchAction.ToolbarLongClicked -> {
|
is SearchAction.ToolbarLongClicked -> {
|
||||||
getSessionById()?.let { session ->
|
getSessionById()?.let { session ->
|
||||||
session.copyUrl(requireContext())
|
session.copyUrl(requireContext())
|
||||||
view?.rootView?.let {
|
view?.let {
|
||||||
FenixSnackbar.make(it, Snackbar.LENGTH_LONG)
|
val snackbar = FenixSnackbar.make(it, Snackbar.LENGTH_LONG)
|
||||||
.setAnchorView(toolbarComponent.uiView.view)
|
|
||||||
.setText(resources.getString(R.string.url_copied))
|
.setText(resources.getString(R.string.url_copied))
|
||||||
.show()
|
|
||||||
|
if (!session.isCustomTabSession()) {
|
||||||
|
snackbar.anchorView = nestedScrollQuickAction
|
||||||
|
}
|
||||||
|
|
||||||
|
snackbar.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,7 +524,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
||||||
it.rootView,
|
it.rootView,
|
||||||
Snackbar.LENGTH_LONG
|
Snackbar.LENGTH_LONG
|
||||||
)
|
)
|
||||||
.setAnchorView(toolbarComponent.uiView.view)
|
.setAnchorView(nestedScrollQuickAction)
|
||||||
.setAction(getString(R.string.edit_bookmark_snackbar_action)) {
|
.setAction(getString(R.string.edit_bookmark_snackbar_action)) {
|
||||||
Navigation.findNavController(
|
Navigation.findNavController(
|
||||||
requireActivity(),
|
requireActivity(),
|
||||||
|
@ -696,6 +700,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
||||||
viewModel?.selectedTabs = selectedSet
|
viewModel?.selectedTabs = selectedSet
|
||||||
viewModel?.saveCollectionStep = SaveCollectionStep.SelectCollection
|
viewModel?.saveCollectionStep = SaveCollectionStep.SelectCollection
|
||||||
viewModel?.tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections.reversed()
|
viewModel?.tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections.reversed()
|
||||||
|
viewModel?.snackbarAnchorView = nestedScrollQuickAction
|
||||||
view?.let {
|
view?.let {
|
||||||
val directions = BrowserFragmentDirections.actionBrowserFragmentToCreateCollectionFragment()
|
val directions = BrowserFragmentDirections.actionBrowserFragmentToCreateCollectionFragment()
|
||||||
Navigation.findNavController(it).navigate(directions)
|
Navigation.findNavController(it).navigate(directions)
|
||||||
|
|
|
@ -173,8 +173,11 @@ class CreateCollectionFragment : DialogFragment(), CoroutineScope {
|
||||||
val string =
|
val string =
|
||||||
if (tabSize > 1) context.getString(R.string.create_collection_tabs_saved) else
|
if (tabSize > 1) context.getString(R.string.create_collection_tabs_saved) else
|
||||||
context.getString(R.string.create_collection_tab_saved)
|
context.getString(R.string.create_collection_tab_saved)
|
||||||
FenixSnackbar.make(view, Snackbar.LENGTH_LONG).setText(string)
|
val snackbar = FenixSnackbar.make(view, Snackbar.LENGTH_LONG).setText(string)
|
||||||
.show()
|
viewModel.snackbarAnchorView?.let {
|
||||||
|
snackbar.setAnchorView(it)
|
||||||
|
}
|
||||||
|
snackbar.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ package org.mozilla.fenix.collections
|
||||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import org.mozilla.fenix.home.sessioncontrol.Tab
|
import org.mozilla.fenix.home.sessioncontrol.Tab
|
||||||
import org.mozilla.fenix.home.sessioncontrol.TabCollection
|
import org.mozilla.fenix.home.sessioncontrol.TabCollection
|
||||||
|
@ -14,4 +15,5 @@ class CreateCollectionViewModel : ViewModel() {
|
||||||
var saveCollectionStep: SaveCollectionStep = SaveCollectionStep.SelectTabs
|
var saveCollectionStep: SaveCollectionStep = SaveCollectionStep.SelectTabs
|
||||||
var tabCollections = listOf<TabCollection>()
|
var tabCollections = listOf<TabCollection>()
|
||||||
var selectedTabCollection: TabCollection? = null
|
var selectedTabCollection: TabCollection? = null
|
||||||
|
var snackbarAnchorView: View? = null
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue