For issue #12387 - Display tab tray using .show
Replaced the global navigation action used for displaying the tab tray with the .show() function.
This commit is contained in:
parent
8826f99ef7
commit
c3041bcb64
|
@ -51,6 +51,7 @@ import org.mozilla.fenix.ext.nav
|
||||||
import org.mozilla.fenix.ext.requireComponents
|
import org.mozilla.fenix.ext.requireComponents
|
||||||
import org.mozilla.fenix.ext.toShortUrl
|
import org.mozilla.fenix.ext.toShortUrl
|
||||||
import org.mozilla.fenix.library.LibraryPageFragment
|
import org.mozilla.fenix.library.LibraryPageFragment
|
||||||
|
import org.mozilla.fenix.tabtray.TabTrayDialogFragment
|
||||||
import org.mozilla.fenix.utils.allowUndo
|
import org.mozilla.fenix.utils.allowUndo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,14 +208,14 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
|
||||||
R.id.open_bookmarks_in_new_tabs_multi_select -> {
|
R.id.open_bookmarks_in_new_tabs_multi_select -> {
|
||||||
openItemsInNewTab { node -> node.url }
|
openItemsInNewTab { node -> node.url }
|
||||||
|
|
||||||
navigate(BookmarkFragmentDirections.actionGlobalTabTrayDialogFragment())
|
showTabTray()
|
||||||
metrics?.track(Event.OpenedBookmarksInNewTabs)
|
metrics?.track(Event.OpenedBookmarksInNewTabs)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.open_bookmarks_in_private_tabs_multi_select -> {
|
R.id.open_bookmarks_in_private_tabs_multi_select -> {
|
||||||
openItemsInNewTab(private = true) { node -> node.url }
|
openItemsInNewTab(private = true) { node -> node.url }
|
||||||
|
|
||||||
navigate(BookmarkFragmentDirections.actionGlobalTabTrayDialogFragment())
|
showTabTray()
|
||||||
metrics?.track(Event.OpenedBookmarksInPrivateTabs)
|
metrics?.track(Event.OpenedBookmarksInPrivateTabs)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -237,6 +238,11 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showTabTray() {
|
||||||
|
invokePendingDeletion()
|
||||||
|
TabTrayDialogFragment.show(parentFragmentManager)
|
||||||
|
}
|
||||||
|
|
||||||
private fun navigate(directions: NavDirections) {
|
private fun navigate(directions: NavDirections) {
|
||||||
invokePendingDeletion()
|
invokePendingDeletion()
|
||||||
findNavController().nav(
|
findNavController().nav(
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.mozilla.fenix.ext.requireComponents
|
||||||
import org.mozilla.fenix.ext.showToolbar
|
import org.mozilla.fenix.ext.showToolbar
|
||||||
import org.mozilla.fenix.ext.toShortUrl
|
import org.mozilla.fenix.ext.toShortUrl
|
||||||
import org.mozilla.fenix.library.LibraryPageFragment
|
import org.mozilla.fenix.library.LibraryPageFragment
|
||||||
|
import org.mozilla.fenix.tabtray.TabTrayDialogFragment
|
||||||
import org.mozilla.fenix.utils.allowUndo
|
import org.mozilla.fenix.utils.allowUndo
|
||||||
|
|
||||||
@SuppressWarnings("TooManyFunctions", "LargeClass")
|
@SuppressWarnings("TooManyFunctions", "LargeClass")
|
||||||
|
@ -184,9 +185,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
|
||||||
selectedItem.url
|
selectedItem.url
|
||||||
}
|
}
|
||||||
|
|
||||||
navigate(
|
showTabTray()
|
||||||
HistoryFragmentDirections.actionGlobalTabTrayDialogFragment()
|
|
||||||
)
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.open_history_in_private_tabs_multi_select -> {
|
R.id.open_history_in_private_tabs_multi_select -> {
|
||||||
|
@ -199,14 +198,18 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
|
||||||
browsingModeManager.mode = BrowsingMode.Private
|
browsingModeManager.mode = BrowsingMode.Private
|
||||||
supportActionBar?.hide()
|
supportActionBar?.hide()
|
||||||
}
|
}
|
||||||
navigate(
|
|
||||||
HistoryFragmentDirections.actionGlobalTabTrayDialogFragment()
|
showTabTray()
|
||||||
)
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
else -> super.onOptionsItemSelected(item)
|
else -> super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showTabTray() {
|
||||||
|
invokePendingDeletion()
|
||||||
|
TabTrayDialogFragment.show(parentFragmentManager)
|
||||||
|
}
|
||||||
|
|
||||||
private fun getMultiSelectSnackBarMessage(historyItems: Set<HistoryItem>): String {
|
private fun getMultiSelectSnackBarMessage(historyItems: Set<HistoryItem>): String {
|
||||||
return if (historyItems.size > 1) {
|
return if (historyItems.size > 1) {
|
||||||
getString(R.string.history_delete_multiple_items_snackbar)
|
getString(R.string.history_delete_multiple_items_snackbar)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user