No issue: Hook up browser menu items Settings and temporary Share
parent
344bc0aea6
commit
3db9f2cb6a
|
@ -5,6 +5,7 @@
|
||||||
package org.mozilla.fenix.components.toolbar
|
package org.mozilla.fenix.components.toolbar
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||||
import mozilla.components.browser.menu.BrowserMenuBuilder
|
import mozilla.components.browser.menu.BrowserMenuBuilder
|
||||||
import mozilla.components.browser.menu.item.BrowserMenuDivider
|
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.browser.session.SessionManager
|
||||||
import mozilla.components.feature.session.SessionUseCases
|
import mozilla.components.feature.session.SessionUseCases
|
||||||
import org.mozilla.fenix.R
|
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.
|
* Component group for all functionality related to the browser toolbar.
|
||||||
|
@ -130,6 +133,18 @@ class Toolbar(
|
||||||
// TODO New Tab
|
// 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(),
|
BrowserMenuDivider(),
|
||||||
|
|
||||||
menuToolbar
|
menuToolbar
|
||||||
|
@ -137,6 +152,8 @@ class Toolbar(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openSettingsActivity() {
|
private fun openSettingsActivity() {
|
||||||
// TODO Open Settings
|
val intent = Intent(context, SettingsActivity::class.java)
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
<string name="browser_menu_private_tab">Private Tab</string>
|
<string name="browser_menu_private_tab">Private Tab</string>
|
||||||
<string name="browser_menu_new_tab">New Tab</string>
|
<string name="browser_menu_new_tab">New Tab</string>
|
||||||
<string name="browser_menu_report_issue">Report Issue</string>
|
<string name="browser_menu_report_issue">Report Issue</string>
|
||||||
|
<string name="browser_menu_share">Share</string>
|
||||||
|
|
||||||
<string name="sessions_intro_description">Fenix will collect your browsing sessions on your Home Screen for you to retrieve later.</string>
|
<string name="sessions_intro_description">Fenix will collect your browsing sessions on your Home Screen for you to retrieve later.</string>
|
||||||
<string name="search_scan_button">Scan</string>
|
<string name="search_scan_button">Scan</string>
|
||||||
<string name="search_shortcuts_button">Shortcuts</string>
|
<string name="search_shortcuts_button">Shortcuts</string>
|
||||||
|
|
Loading…
Reference in New Issue