1
0
Fork 0

Fixes #5917: Show snackbar when URL is copied (#6210)

Show a snackbar to the user for him to know that the URL was copied to
clipboard.
master
ValentinTimisica 2019-11-01 01:53:00 +02:00 committed by Emily Kager
parent 9456998f9f
commit 1e13e70cd0
2 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import android.widget.LinearLayout
import android.widget.PopupWindow
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.browser_toolbar_popup_window.view.*
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
@ -21,6 +22,7 @@ import mozilla.components.browser.toolbar.display.DisplayToolbar
import mozilla.components.support.ktx.android.util.dpToFloat
import org.jetbrains.anko.dimen
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.customtabs.CustomTabToolbarMenu
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.theme.ThemeManager
@ -81,6 +83,11 @@ class BrowserToolbarView(
} else {
clipboard.text = selectedSession?.url
}
FenixSnackbar.make(view, Snackbar.LENGTH_SHORT)
.setText(view.context.getString(R.string.browser_toolbar_url_copied_to_clipboard_snackbar))
.setAnchorView(view)
.show()
}
customView.paste.setOnClickListener {

View File

@ -927,7 +927,9 @@
<string name="browser_toolbar_long_press_popup_paste_and_go">Paste &amp; Go</string>
<!-- Paste the text in the clipboard -->
<string name="browser_toolbar_long_press_popup_paste">Paste</string>
<!-- Snackbar message shown after an URL has been copied to clipboard. -->
<string name="browser_toolbar_url_copied_to_clipboard_snackbar">URL copied to clipboard</string>
<!-- Title text for the Add To Homescreen dialog -->
<string name="add_to_homescreen_title">Add to Home screen</string>
<!-- Cancel button text for the Add to Homescreen dialog -->