2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For issue https://github.com/mozilla-mobile/fenix/issues/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:
Mihai Eduard Badea 2020-07-21 10:18:13 +03:00 committed by Jeff Boek
parent 2320c617b2
commit 130de798fb
2 changed files with 17 additions and 8 deletions

View File

@ -51,6 +51,7 @@ import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.toShortUrl
import org.mozilla.fenix.library.LibraryPageFragment
import org.mozilla.fenix.tabtray.TabTrayDialogFragment
import org.mozilla.fenix.utils.allowUndo
/**
@ -207,14 +208,14 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
R.id.open_bookmarks_in_new_tabs_multi_select -> {
openItemsInNewTab { node -> node.url }
navigate(BookmarkFragmentDirections.actionGlobalTabTrayDialogFragment())
showTabTray()
metrics?.track(Event.OpenedBookmarksInNewTabs)
true
}
R.id.open_bookmarks_in_private_tabs_multi_select -> {
openItemsInNewTab(private = true) { node -> node.url }
navigate(BookmarkFragmentDirections.actionGlobalTabTrayDialogFragment())
showTabTray()
metrics?.track(Event.OpenedBookmarksInPrivateTabs)
true
}
@ -237,6 +238,11 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
}
}
private fun showTabTray() {
invokePendingDeletion()
TabTrayDialogFragment.show(parentFragmentManager)
}
private fun navigate(directions: NavDirections) {
invokePendingDeletion()
findNavController().nav(

View File

@ -44,6 +44,7 @@ import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.ext.toShortUrl
import org.mozilla.fenix.library.LibraryPageFragment
import org.mozilla.fenix.tabtray.TabTrayDialogFragment
import org.mozilla.fenix.utils.allowUndo
@SuppressWarnings("TooManyFunctions", "LargeClass")
@ -184,9 +185,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
selectedItem.url
}
navigate(
HistoryFragmentDirections.actionGlobalTabTrayDialogFragment()
)
showTabTray()
true
}
R.id.open_history_in_private_tabs_multi_select -> {
@ -199,14 +198,18 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
browsingModeManager.mode = BrowsingMode.Private
supportActionBar?.hide()
}
navigate(
HistoryFragmentDirections.actionGlobalTabTrayDialogFragment()
)
showTabTray()
true
}
else -> super.onOptionsItemSelected(item)
}
private fun showTabTray() {
invokePendingDeletion()
TabTrayDialogFragment.show(parentFragmentManager)
}
private fun getMultiSelectSnackBarMessage(historyItems: Set<HistoryItem>): String {
return if (historyItems.size > 1) {
getString(R.string.history_delete_multiple_items_snackbar)