[Android] Add custom seek action icons for Auto and Wear

Robert Stone git at videolan.org
Thu Feb 3 09:01:34 UTC 2022


vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Fri Jan 21 22:44:58 2022 -0800| [60c18d86d6226055bd00f46c92f05390bce3f89d] | committer: Nicolas Pomepuy

Add custom seek action icons for Auto and Wear

> https://code.videolan.org/videolan/vlc-android/commit/60c18d86d6226055bd00f46c92f05390bce3f89d
---

 .../assets/images/svg/ic_auto_forward.svg          | 68 ++++++++++++++++++++++
 .../resources/assets/images/svg/ic_auto_rewind.svg | 68 ++++++++++++++++++++++
 .../src/main/res/drawable/ic_auto_forward.xml      | 13 +++++
 .../src/main/res/drawable/ic_auto_rewind.xml       | 13 +++++
 .../src/org/videolan/vlc/PlaybackService.kt        |  9 ++-
 5 files changed, 169 insertions(+), 2 deletions(-)

diff --git a/application/resources/assets/images/svg/ic_auto_forward.svg b/application/resources/assets/images/svg/ic_auto_forward.svg
new file mode 100644
index 000000000..5c39821f6
--- /dev/null
+++ b/application/resources/assets/images/svg/ic_auto_forward.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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="48"
+   height="48"
+   viewBox="0 0 48 48"
+   version="1.1"
+   id="SVGRoot"
+   inkscape:version="1.0.1 (c497b03c, 2020-09-10)"
+   sodipodi:docname="ic_auto_forward.svg">
+  <defs
+     id="defs2412" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="6.1421982"
+     inkscape:cx="16.319661"
+     inkscape:cy="49.072829"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1214"
+     inkscape:window-height="855"
+     inkscape:window-x="116"
+     inkscape:window-y="23"
+     inkscape:window-maximized="0"
+     inkscape:grid-bbox="true"
+     inkscape:snap-grids="true"
+     inkscape:snap-page="true"
+     inkscape:document-rotation="0">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2968"
+       originx="0"
+       originy="0" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata2415">
+    <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></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       id="path2737"
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke"
+       d="M 25.177734,4.8203125 C 24.523654,4.8323185 23.999951,5.3653552 24,6.0195312 v 5.1601568 c -8.836555,0 -16,7.163443 -16,16 0,8.836555 7.163445,16 16,16 8.836555,0 16,-7.163447 16,-16 h -3.199219 c 0,7.069243 -5.731536,12.800781 -12.800781,12.800781 -7.069245,0 -12.800781,-5.731538 -12.800781,-12.800781 0,-7.069245 5.731536,-12.800782 12.800781,-12.800782 v 5.197266 c 4.16e-4,1.067557 1.290286,1.602839 2.046875,0.849609 l 6.802734,-6.796875 c 0.46951,-0.469812 0.469608,-1.231181 -0.002,-1.699218 L 26.046875,5.1679688 C 25.81623,4.9396297 25.502262,4.813672 25.177734,4.8203125 Z" />
+  </g>
+</svg>
diff --git a/application/resources/assets/images/svg/ic_auto_rewind.svg b/application/resources/assets/images/svg/ic_auto_rewind.svg
new file mode 100644
index 000000000..941c6417a
--- /dev/null
+++ b/application/resources/assets/images/svg/ic_auto_rewind.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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="48"
+   height="48"
+   viewBox="0 0 48 48"
+   version="1.1"
+   id="SVGRoot"
+   inkscape:version="1.0.1 (c497b03c, 2020-09-10)"
+   sodipodi:docname="ic_auto_rewind.svg">
+  <defs
+     id="defs2412" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="11.003914"
+     inkscape:cx="21.081924"
+     inkscape:cy="28.645893"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1190"
+     inkscape:window-height="855"
+     inkscape:window-x="61"
+     inkscape:window-y="23"
+     inkscape:window-maximized="0"
+     inkscape:grid-bbox="true"
+     inkscape:snap-grids="true"
+     inkscape:snap-page="true"
+     inkscape:document-rotation="0">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2968"
+       originx="0"
+       originy="0" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata2415">
+    <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></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       id="path2737"
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke"
+       d="m 22.822266,4.8203125 c -0.324528,-0.00672 -0.638421,0.1193245 -0.869141,0.3476563 l -6.800781,6.7617192 c -0.471343,0.468037 -0.471179,1.229407 -0.002,1.699218 l 6.802734,6.796875 C 22.709993,21.17901 23.999584,20.643729 24,19.576172 V 14.378906 A 12.8,12.8 0 0 1 36.800781,27.179688 12.8,12.8 0 0 1 24,39.980469 12.8,12.8 0 0 1 11.199219,27.179688 H 8 a 16,16 0 0 0 16,16 16,16 0 0 0 16,-16 16,16 0 0 0 -16,-16 V 6.0195312 c 4.8e-5,-0.6541759 -0.523654,-1.1872187 -1.177734,-1.1992187 z" />
+  </g>
+</svg>
diff --git a/application/resources/src/main/res/drawable/ic_auto_forward.xml b/application/resources/src/main/res/drawable/ic_auto_forward.xml
new file mode 100644
index 000000000..8324bb186
--- /dev/null
+++ b/application/resources/src/main/res/drawable/ic_auto_forward.xml
@@ -0,0 +1,13 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="48dp"
+    android:height="48dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48">
+  <path
+      android:pathData="M25.1777,4.8203C24.5237,4.8323 24,5.3654 24,6.0195v5.1602c-8.8366,0 -16,7.1634 -16,16 0,8.8366 7.1634,16 16,16 8.8366,0 16,-7.1634 16,-16h-3.1992c0,7.0692 -5.7315,12.8008 -12.8008,12.8008 -7.0692,0 -12.8008,-5.7315 -12.8008,-12.8008 0,-7.0692 5.7315,-12.8008 12.8008,-12.8008v5.1973c0.0004,1.0676 1.2903,1.6028 2.0469,0.8496l6.8027,-6.7969c0.4695,-0.4698 0.4696,-1.2312 -0.002,-1.6992L26.0469,5.168C25.8162,4.9396 25.5023,4.8137 25.1777,4.8203Z"
+      android:strokeLineJoin="round"
+      android:strokeWidth="3.2"
+      android:fillColor="#000000"
+      android:strokeColor="#00000000"
+      android:strokeLineCap="round"/>
+</vector>
diff --git a/application/resources/src/main/res/drawable/ic_auto_rewind.xml b/application/resources/src/main/res/drawable/ic_auto_rewind.xml
new file mode 100644
index 000000000..85baa7f37
--- /dev/null
+++ b/application/resources/src/main/res/drawable/ic_auto_rewind.xml
@@ -0,0 +1,13 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="48dp"
+    android:height="48dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48">
+  <path
+      android:pathData="m22.8223,4.8203c-0.3245,-0.0067 -0.6384,0.1193 -0.8691,0.3477l-6.8008,6.7617c-0.4713,0.468 -0.4712,1.2294 -0.002,1.6992l6.8027,6.7969C22.71,21.179 23.9996,20.6437 24,19.5762V14.3789A12.8,12.8 0,0 1,36.8008 27.1797,12.8 12.8,0 0,1 24,39.9805 12.8,12.8 0,0 1,11.1992 27.1797H8a16,16 0,0 0,16 16,16 16,0 0,0 16,-16 16,16 0,0 0,-16 -16V6.0195c0,-0.6542 -0.5237,-1.1872 -1.1777,-1.1992z"
+      android:strokeLineJoin="round"
+      android:strokeWidth="3.2"
+      android:fillColor="#000000"
+      android:strokeColor="#00000000"
+      android:strokeLineCap="round"/>
+</vector>
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index e34337d44..c525af71a 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -1113,12 +1113,17 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
 
     private fun addCustomSeekActions(pscb: PlaybackStateCompat.Builder, showSeekActions: Boolean = true) {
         if (!showSeekActions) return
+        val ctx = applicationContext
+        /* Rewind */
         pscb.addCustomAction(PlaybackStateCompat.CustomAction.Builder(CUSTOM_ACTION_REWIND,
-                getString(R.string.playback_rewind), R.drawable.ic_auto_rewind_10)
+                getString(R.string.playback_rewind),
+                DrawableCache.getDrawableFromMemCache(ctx, "ic_auto_rewind_${Settings.audioJumpDelay}", R.drawable.ic_auto_rewind))
                 .setExtras(Bundle().apply { putBoolean(WEARABLE_SHOW_CUSTOM_ACTION, true) })
                 .build())
+        /* Fast Forward */
         pscb.addCustomAction(PlaybackStateCompat.CustomAction.Builder(CUSTOM_ACTION_FAST_FORWARD,
-                getString(R.string.playback_forward), R.drawable.ic_auto_forward_10)
+                getString(R.string.playback_forward),
+                DrawableCache.getDrawableFromMemCache(ctx, "ic_auto_forward_${Settings.audioJumpDelay}", R.drawable.ic_auto_forward))
                 .setExtras(Bundle().apply { putBoolean(WEARABLE_SHOW_CUSTOM_ACTION, true) })
                 .build())
     }



More information about the Android mailing list