2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

For #1573 - Add Browsing Menu Item Add To Collections

This commit is contained in:
Emily Kager 2019-04-29 11:14:24 -07:00 committed by Emily Kager
parent d6879e2501
commit 14c4d12e49
5 changed files with 18 additions and 1 deletions

View File

@ -477,6 +477,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope,
ToolbarMenu.Item.NewTab -> Item.NEW_TAB ToolbarMenu.Item.NewTab -> Item.NEW_TAB
ToolbarMenu.Item.OpenInFenix -> Item.OPEN_IN_FENIX ToolbarMenu.Item.OpenInFenix -> Item.OPEN_IN_FENIX
ToolbarMenu.Item.Share -> Item.SHARE ToolbarMenu.Item.Share -> Item.SHARE
ToolbarMenu.Item.SaveToCollection -> Item.SAVE_TO_COLLECTION
} }
requireComponents.analytics.metrics.track(Event.BrowserMenuItemTapped(item)) requireComponents.analytics.metrics.track(Event.BrowserMenuItemTapped(item))
@ -527,6 +528,10 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope,
Navigation.findNavController(view!!).navigate(directions) Navigation.findNavController(view!!).navigate(directions)
(activity as HomeActivity).browsingModeManager.mode = BrowsingModeManager.Mode.Normal (activity as HomeActivity).browsingModeManager.mode = BrowsingModeManager.Mode.Normal
} }
ToolbarMenu.Item.SaveToCollection -> {
ItsNotBrokenSnack(requireContext())
.showSnackbar("1843")
}
ToolbarMenu.Item.OpenInFenix -> { ToolbarMenu.Item.OpenInFenix -> {
val intent = Intent(context, IntentReceiverActivity::class.java) val intent = Intent(context, IntentReceiverActivity::class.java)
intent.action = Intent.ACTION_VIEW intent.action = Intent.ACTION_VIEW

View File

@ -195,7 +195,8 @@ sealed class Event {
data class BrowserMenuItemTapped(val item: Item) : Event() { data class BrowserMenuItemTapped(val item: Item) : Event() {
enum class Item { enum class Item {
SETTINGS, LIBRARY, HELP, DESKTOP_VIEW_ON, DESKTOP_VIEW_OFF, FIND_IN_PAGE, NEW_TAB, SETTINGS, LIBRARY, HELP, DESKTOP_VIEW_ON, DESKTOP_VIEW_OFF, FIND_IN_PAGE, NEW_TAB,
NEW_PRIVATE_TAB, SHARE, REPORT_SITE_ISSUE, BACK, FORWARD, RELOAD, STOP, OPEN_IN_FENIX NEW_PRIVATE_TAB, SHARE, REPORT_SITE_ISSUE, BACK, FORWARD, RELOAD, STOP, OPEN_IN_FENIX,
SAVE_TO_COLLECTION
} }
override val extras: Map<String, String>? override val extras: Map<String, String>?

View File

@ -164,6 +164,14 @@ class DefaultToolbarMenu(
onItemTapped.invoke(ToolbarMenu.Item.ReportIssue) onItemTapped.invoke(ToolbarMenu.Item.ReportIssue)
}, },
BrowserMenuImageText(
context.getString(R.string.browser_menu_save_to_collection),
R.drawable.ic_archive,
DefaultThemeManager.resolveAttribute(R.attr.primaryText, context)
) {
onItemTapped.invoke(ToolbarMenu.Item.SaveToCollection)
},
BrowserMenuDivider(), BrowserMenuDivider(),
menuToolbar menuToolbar

View File

@ -19,6 +19,7 @@ interface ToolbarMenu {
object Stop : Item() object Stop : Item()
object ReportIssue : Item() object ReportIssue : Item()
object OpenInFenix : Item() object OpenInFenix : Item()
object SaveToCollection : Item()
} }
val menuBuilder: BrowserMenuBuilder val menuBuilder: BrowserMenuBuilder

View File

@ -54,6 +54,8 @@
<string name="browser_menu_private_tab">Private tab</string> <string name="browser_menu_private_tab">Private tab</string>
<!-- Browser menu button that creates a new tab --> <!-- Browser menu button that creates a new tab -->
<string name="browser_menu_new_tab">New tab</string> <string name="browser_menu_new_tab">New tab</string>
<!-- Browser menu button that saves the current tab to a collection -->
<string name="browser_menu_save_to_collection">Save to Collection</string>
<!-- Browser menu button that opens a dialog to report issues with the current site --> <!-- Browser menu button that opens a dialog to report issues with the current site -->
<string name="browser_menu_report_issue">Report site issue</string> <string name="browser_menu_report_issue">Report site issue</string>
<!-- Browser menu button that open a share menu to share the current site --> <!-- Browser menu button that open a share menu to share the current site -->