Closes #133 - Create Browser Menu UI
parent
82581e8f2b
commit
5903cefa6b
|
@ -7,9 +7,10 @@ package org.mozilla.fenix.components.toolbar
|
|||
import android.content.Context
|
||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||
import mozilla.components.browser.menu.BrowserMenuBuilder
|
||||
import mozilla.components.browser.menu.item.BrowserMenuDivider
|
||||
import mozilla.components.browser.menu.item.BrowserMenuImageText
|
||||
import mozilla.components.browser.menu.item.BrowserMenuItemToolbar
|
||||
import mozilla.components.browser.menu.item.BrowserMenuSwitch
|
||||
import mozilla.components.browser.menu.item.SimpleBrowserMenuItem
|
||||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.feature.session.SessionUseCases
|
||||
import org.mozilla.fenix.R
|
||||
|
@ -65,19 +66,35 @@ class Toolbar(
|
|||
|
||||
private val menuItems by lazy {
|
||||
listOf(
|
||||
menuToolbar,
|
||||
SimpleBrowserMenuItem(context.getString(R.string.browser_menu_help)) {
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_help),
|
||||
R.drawable.ic_help,
|
||||
context.getString(R.string.browser_menu_help),
|
||||
R.color.icons
|
||||
) {
|
||||
// TODO Help
|
||||
},
|
||||
|
||||
SimpleBrowserMenuItem(context.getString(R.string.browser_menu_settings)) {
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_settings),
|
||||
R.drawable.ic_settings,
|
||||
context.getString(R.string.browser_menu_settings),
|
||||
R.color.icons
|
||||
) {
|
||||
openSettingsActivity()
|
||||
},
|
||||
|
||||
SimpleBrowserMenuItem(context.getString(R.string.browser_menu_library)) {
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_library),
|
||||
R.drawable.ic_library,
|
||||
context.getString(R.string.browser_menu_library),
|
||||
R.color.icons
|
||||
) {
|
||||
// TODO Your Library
|
||||
},
|
||||
|
||||
BrowserMenuDivider(),
|
||||
|
||||
BrowserMenuSwitch(context.getString(R.string.browser_menu_desktop_site), {
|
||||
sessionManager.selectedSessionOrThrow.desktopMode
|
||||
}) { checked ->
|
||||
|
@ -86,17 +103,36 @@ class Toolbar(
|
|||
visible = { sessionManager.selectedSession != null }
|
||||
},
|
||||
|
||||
SimpleBrowserMenuItem(context.getString(R.string.browser_menu_find_in_page)) {
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_find_in_page),
|
||||
R.drawable.mozac_ic_search,
|
||||
context.getString(R.string.browser_menu_find_in_page),
|
||||
R.color.icons
|
||||
) {
|
||||
// TODO Find in Page
|
||||
},
|
||||
|
||||
SimpleBrowserMenuItem(context.getString(R.string.browser_menu_private_tab)) {
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_private_tab),
|
||||
R.drawable.ic_private_browsing,
|
||||
context.getString(R.string.browser_menu_private_tab),
|
||||
R.color.icons
|
||||
) {
|
||||
// TODO Private Tab
|
||||
},
|
||||
|
||||
SimpleBrowserMenuItem(context.getString(R.string.browser_menu_new_tab)) {
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_new_tab),
|
||||
R.drawable.ic_new,
|
||||
context.getString(R.string.browser_menu_new_tab),
|
||||
R.color.icons
|
||||
) {
|
||||
// TODO New Tab
|
||||
}
|
||||
},
|
||||
|
||||
BrowserMenuDivider(),
|
||||
|
||||
menuToolbar
|
||||
)
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- 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/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillAlpha=".8"
|
||||
android:fillColor="#0C0C0D"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M5,4a1,1 0,1 0,-2 0v16a1,1 0,1 0,2 0L5,4zM9,7a1,1 0,1 0,-2 0v13a1,1 0,1 0,2 0L9,7zM12,5a1,1 0,0 1,1 1v14a1,1 0,1 1,-2 0L11,6a1,1 0,0 1,1 -1zM16.452,5.694a1,1 0,1 0,-1.904 0.612l4.5,14a1,1 0,1 0,1.904 -0.612l-4.5,-14z" />
|
||||
</vector>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- 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/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillAlpha=".8"
|
||||
android:fillColor="#0C0C0D"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M13,4a1,1 0,1 0,-2 0v7H4a1,1 0,1 0,0 2h7v7a1,1 0,1 0,2 0v-7h7a1,1 0,1 0,0 -2h-7V4z" />
|
||||
</vector>
|
File diff suppressed because one or more lines are too long
|
@ -5,4 +5,5 @@
|
|||
<resources>
|
||||
<dimen name="glyph_button_height">48dp</dimen>
|
||||
<dimen name="glyph_button_width">48dp</dimen>
|
||||
<dimen name="mozac_browser_menu_corner_radius">14dp</dimen>
|
||||
</resources>
|
Loading…
Reference in New Issue