[Android] Copy URL: add a visual feedback and a proper icon

Nicolas Pomepuy git at videolan.org
Tue Sep 24 17:07:56 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Sep 24 16:08:31 2019 +0200| [24a1d496ac4c8a9c64a5b2270dc6405abf392fcc] | committer: Geoffrey Métais

Copy URL: add a visual feedback and a proper icon

(cherry picked from commit 592e56b85618bdd8cc53267ed83aca07325260be)

> https://code.videolan.org/videolan/vlc-android/commit/24a1d496ac4c8a9c64a5b2270dc6405abf392fcc
---

 assets/images/svg/ic_ctx_link_normal.svg           | 41 ++++++++++++++++++++++
 vlc-android/res/drawable/ic_ctx_link_normal.xml    | 38 ++++++++++++++++++++
 vlc-android/res/values/strings.xml                 |  1 +
 .../org/videolan/vlc/gui/dialogs/ContextSheet.kt   |  2 +-
 .../videolan/vlc/gui/network/MRLPanelFragment.kt   |  2 ++
 5 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/assets/images/svg/ic_ctx_link_normal.svg b/assets/images/svg/ic_ctx_link_normal.svg
new file mode 100644
index 000000000..d538dae88
--- /dev/null
+++ b/assets/images/svg/ic_ctx_link_normal.svg
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#"
+        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
+        xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+        xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="20" height="20"
+        id="svg4682" version="1.1" inkscape:version="0.92.3 (2405546, 2018-03-11)"
+        sodipodi:docname="ic_ctx_link_normal.svg"
+        inkscape:export-filename="/home/corbax/Dev/android/Icons/Test 1/ic_play_normal.png"
+        inkscape:export-xdpi="90" inkscape:export-ydpi="90">
+    <defs id="defs4684" />
+    <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0"
+            inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="44.8"
+            inkscape:cx="7.0083751" inkscape:cy="6.94558" inkscape:document-units="px"
+            inkscape:current-layer="layer1" showgrid="true" inkscape:window-width="1600"
+            inkscape:window-height="836" inkscape:window-x="0" inkscape:window-y="27"
+            inkscape:window-maximized="1" inkscape:snap-bbox="true" inkscape:bbox-nodes="true"
+            inkscape:bbox-paths="true" inkscape:snap-bbox-edge-midpoints="true"
+            inkscape:snap-bbox-midpoints="true" inkscape:object-paths="true"
+            inkscape:snap-intersection-paths="true" inkscape:object-nodes="true"
+            inkscape:snap-smooth-nodes="true" inkscape:snap-midpoints="true"
+            inkscape:snap-object-midpoints="true" inkscape:snap-center="true">
+        <inkscape:grid type="xygrid" id="grid3002" />
+    </sodipodi:namedview>
+    <metadata id="metadata4687">
+        <rdf:RDF>
+            <cc:Work rdf:about="">
+                <dc:format>image/svg+xml</dc:format>
+                <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+                <dc:title />
+            </cc:Work>
+        </rdf:RDF>
+    </metadata>
+    <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1"
+            transform="translate(0,-1032.3622)">
+        <path style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.32731667;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+                d="m 5.75,1038.6122 a 3.7499783,3.7499783 0 0 0 -3.75,3.75 3.7499783,3.7499783 0 0 0 3.75,3.75 H 9 v -1.5 H 5.75 a 2.249987,2.249987 0 0 1 -2.25,-2.25 2.249987,2.249987 0 0 1 2.25,-2.25 H 9 v -1.5 z m 5.25,0 v 1.5 h 3.25 a 2.249987,2.249987 0 0 1 2.25,2.25 2.249987,2.249987 0 0 1 -2.25,2.25 H 11 v 1.5 h 3.25 a 3.7499783,3.7499783 0 0 0 3.75,-3.75 3.7499783,3.7499783 0 0 0 -3.75,-3.75 z m -4,3 v 1.5 h 6 v -1.5 z"
+                id="rect6696" inkscape:connector-curvature="0" />
+    </g>
+</svg>
diff --git a/vlc-android/res/drawable/ic_ctx_link_normal.xml b/vlc-android/res/drawable/ic_ctx_link_normal.xml
new file mode 100644
index 000000000..5ca65aa98
--- /dev/null
+++ b/vlc-android/res/drawable/ic_ctx_link_normal.xml
@@ -0,0 +1,38 @@
+<!--
+  ~ *************************************************************************
+  ~  ic_ctx_link_normal.xml
+  ~ **************************************************************************
+  ~ Copyright © 2019 VLC authors and VideoLAN
+  ~ Author: Nicolas POMEPUY
+  ~ This program is free software; you can redistribute it and/or modify
+  ~ it under the terms of the GNU General Public License as published by
+  ~ the Free Software Foundation; either version 2 of the License, or
+  ~ (at your option) any later version.
+  ~
+  ~ This program is distributed in the hope th202020202020at it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  ~ GNU General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with this program; if not, write to the Free Software
+  ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+  ~ ***************************************************************************
+  ~
+  ~
+  -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="38dp"
+        android:height="38dp"
+        android:viewportWidth="20"
+        android:viewportHeight="20">
+    <path
+            android:pathData="m5.75,6.25a3.75,3.75 0,0 0,-3.75 3.75,3.75 3.75,0 0,0 3.75,3.75L9,13.75v-1.5L5.75,12.25a2.25,2.25 0,0 1,-2.25 -2.25,2.25 2.25,0 0,1 2.25,-2.25L9,7.75v-1.5zM11,6.25v1.5h3.25a2.25,2.25 0,0 1,2.25 2.25,2.25 2.25,0 0,1 -2.25,2.25L11,12.25v1.5h3.25a3.75,3.75 0,0 0,3.75 -3.75,3.75 3.75,0 0,0 -3.75,-3.75zM7,9.25v1.5h6v-1.5z"
+            android:strokeAlpha="1"
+            android:strokeLineJoin="miter"
+            android:strokeWidth="0.32731667"
+            android:fillColor="#000000"
+            android:strokeColor="#00000000"
+            android:fillAlpha="1" />
+</vector>
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 412411166..9ee5a9a50 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -741,4 +741,5 @@
     <string name="video_group_size_dialog_text">Number of characters used to group by name</string>
     <string name="video_group_size_summary">Group by %s first letters</string>
     <string name="video_group_size">Group videos by name</string>
+    <string name="url_copied_to_clipboard">Url copied to clipboard</string>
 </resources>
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
index d173a4bfe..c7b6e91c7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
@@ -107,7 +107,7 @@ class ContextSheet : VLCBottomSheetDialogFragment() {
         if (flags and CTX_REMOVE_FROM_PLAYLIST != 0) add(Simple(CTX_REMOVE_FROM_PLAYLIST, getString(R.string.remove), R.drawable.ic_ctx_remove_from_playlist_normal))
         if (flags and CTX_STOP_AFTER_THIS != 0) add(Simple(CTX_STOP_AFTER_THIS, getString(R.string.stop_after_this), R.drawable.ic_ctx_stop_after_this))
         if (flags and CTX_RENAME != 0) add(Simple(CTX_RENAME, getString(R.string.rename), R.drawable.ic_ctx_edit_normal))
-        if (flags and CTX_COPY != 0) add(Simple(CTX_COPY, getString(R.string.copy_to_clipboard), R.drawable.ic_ctx_edit_normal))
+        if (flags and CTX_COPY != 0) add(Simple(CTX_COPY, getString(R.string.copy_to_clipboard), R.drawable.ic_ctx_link_normal))
         if (flags and CTX_DELETE != 0) add(Simple(CTX_DELETE, getString(R.string.delete), R.drawable.ic_ctx_delete_normal))
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index e1bec1b1e..771ce5f83 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -40,6 +40,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
 import androidx.recyclerview.widget.GridLayoutManager
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
+import com.google.android.material.snackbar.Snackbar
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import kotlinx.coroutines.channels.actor
@@ -182,6 +183,7 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
             CTX_COPY -> {
                 val media = viewModel.dataset.value[position]
                 requireContext().copy(media.title, media.location)
+                Snackbar.make(requireActivity().window.decorView.findViewById<View>(android.R.id.content), R.string.url_copied_to_clipboard, Snackbar.LENGTH_LONG).show()
             }
         }
     }



More information about the Android mailing list