Closes #133 - Create Browser Menu UI

nightly-build-test
Emily Kager 5 years ago committed by Sawyer Blatz
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
)
}

@ -0,0 +1,18 @@
<?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:pathData="M13.15,17a1.15,1.15 0,1 1,-2.3 0,1.15 1.15,0 0,1 2.3,0zM10.5,9.5c0,-0.764 0.616,-1.5 1.5,-1.5s1.5,0.736 1.5,1.5c0,0.311 -0.144,0.635 -0.408,0.974 -0.199,0.254 -0.386,0.43 -0.57,0.6 -0.077,0.072 -0.153,0.143 -0.23,0.219a1.676,1.676 0,0 1,-0.048 0.045c-0.13,0.117 -0.466,0.42 -0.698,0.757C11.22,12.569 11,13.18 11,14a1,1 0,1 0,2 0c0,-0.431 0.106,-0.645 0.194,-0.772 0.051,-0.074 0.114,-0.144 0.197,-0.225 0.04,-0.039 0.08,-0.075 0.129,-0.12l0.003,-0.002 0.009,-0.008c0.05,-0.045 0.114,-0.104 0.175,-0.166l0.086,-0.08a8.13,8.13 0,0 0,0.876 -0.924c0.4,-0.512 0.831,-1.264 0.831,-2.203C15.5,7.764 14.116,6 12,6S8.5,7.764 8.5,9.5a1,1 0,1 0,2 0z" />
<path
android:fillAlpha=".8"
android:fillColor="#0C0C0D"
android:fillType="evenOdd"
android:pathData="M12,22c5.523,0 10,-4.477 10,-10S17.523,2 12,2 2,6.477 2,12s4.477,10 10,10zM12,20a8,8 0,1 0,0 -16,8 8,0 0,0 0,16z" />
</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="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>

@ -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="M12,22a1,1 0,0 1,-1 -1v-3.083a5.966,5.966 0,0 1,-2.477 -1.026l-2.18,2.18a1,1 0,0 1,-1.414 -1.414l2.18,-2.18A5.967,5.967 0,0 1,6.083 13H3a1,1 0,1 1,0 -2h3.083a5.968,5.968 0,0 1,1.026 -2.477l-2.18,-2.18A1,1 0,0 1,6.343 4.93l2.18,2.18A5.968,5.968 0,0 1,11 6.083V3a1,1 0,1 1,2 0v3.083a5.967,5.967 0,0 1,2.476 1.026l2.18,-2.18a1,1 0,1 1,1.415 1.414l-2.18,2.18A5.966,5.966 0,0 1,17.917 11H21a1,1 0,1 1,0 2h-3.083a5.966,5.966 0,0 1,-1.026 2.476l2.18,2.18a1,1 0,0 1,-1.414 1.415l-2.18,-2.18A5.966,5.966 0,0 1,13 17.917V21a1,1 0,0 1,-1 1zM8,12a4,4 0,1 1,8 0,4 4,0 0,1 -8,0z" />
</vector>

@ -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…
Cancel
Save