From 3db9f2cb6ac0b8b4ccb9668261fa4f5665dfe275 Mon Sep 17 00:00:00 2001 From: Emily Kager Date: Fri, 1 Feb 2019 15:34:41 -0800 Subject: [PATCH] No issue: Hook up browser menu items Settings and temporary Share --- .../fenix/components/toolbar/Toolbar.kt | 19 ++++++++++++++++++- app/src/main/res/values/strings.xml | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt index b86282ec4..cadada2bd 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt @@ -5,6 +5,7 @@ package org.mozilla.fenix.components.toolbar import android.content.Context +import android.content.Intent import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider import mozilla.components.browser.menu.BrowserMenuBuilder import mozilla.components.browser.menu.item.BrowserMenuDivider @@ -14,6 +15,8 @@ import mozilla.components.browser.menu.item.BrowserMenuSwitch import mozilla.components.browser.session.SessionManager import mozilla.components.feature.session.SessionUseCases import org.mozilla.fenix.R +import org.mozilla.fenix.ext.share +import org.mozilla.fenix.settings.SettingsActivity /** * Component group for all functionality related to the browser toolbar. @@ -130,6 +133,18 @@ class Toolbar( // TODO New Tab }, + BrowserMenuImageText( + context.getString(R.string.browser_menu_share), + R.drawable.mozac_ic_share, + context.getString(R.string.browser_menu_share), + R.color.icons + ) { + val url = sessionManager.selectedSession?.url ?: "" + context.share(url) + }.apply { + visible = { sessionManager.selectedSession != null } + }, + BrowserMenuDivider(), menuToolbar @@ -137,6 +152,8 @@ class Toolbar( } private fun openSettingsActivity() { - // TODO Open Settings + val intent = Intent(context, SettingsActivity::class.java) + intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK + context.startActivity(intent) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d2e0c58f6..27075df7a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,6 +19,8 @@ Private Tab New Tab Report Issue + Share + Fenix will collect your browsing sessions on your Home Screen for you to retrieve later. Scan Shortcuts