|
|
|
@ -4,6 +4,8 @@
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.browser
|
|
|
|
|
|
|
|
|
|
import android.content.ClipData
|
|
|
|
|
import android.content.ClipboardManager
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.net.Uri
|
|
|
|
@ -282,7 +284,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
|
|
|
|
getAutoDisposeObservable<SearchAction>()
|
|
|
|
|
.subscribe {
|
|
|
|
|
when (it) {
|
|
|
|
|
is SearchAction.ToolbarTapped -> {
|
|
|
|
|
is SearchAction.ToolbarClicked -> {
|
|
|
|
|
Navigation
|
|
|
|
|
.findNavController(toolbarComponent.getView())
|
|
|
|
|
.navigate(
|
|
|
|
@ -299,6 +301,9 @@ class BrowserFragment : Fragment(), BackHandler {
|
|
|
|
|
trackToolbarItemInteraction(it)
|
|
|
|
|
handleToolbarItemInteraction(it)
|
|
|
|
|
}
|
|
|
|
|
is SearchAction.ToolbarLongClicked -> {
|
|
|
|
|
getSessionByIdOrUseSelectedSession().copyUrl(requireContext())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -475,6 +480,17 @@ class BrowserFragment : Fragment(), BackHandler {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun Session.copyUrl(context: Context) {
|
|
|
|
|
val clipBoard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
|
|
|
|
val uri = Uri.parse(url)
|
|
|
|
|
clipBoard.primaryClip = ClipData.newRawUri("Uri", uri)
|
|
|
|
|
|
|
|
|
|
val rootView = context.asActivity()?.window?.decorView?.findViewById<View>(android.R.id.content) as ViewGroup
|
|
|
|
|
FenixSnackbar.make(rootView, Snackbar.LENGTH_LONG)
|
|
|
|
|
.setText(context.getString(R.string.url_copied))
|
|
|
|
|
.show()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
|
|
|
|
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
|
|
|
|