[Android] Add a shadow to the brightness / volume bar in the player

Nicolas Pomepuy git at videolan.org
Tue Nov 2 12:31:14 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Oct 18 14:55:54 2021 +0200| [4356d65c42dec891729c6db6951eb0e0043e9136] | committer: Nicolas Pomepuy

Add a shadow to the brightness / volume bar in the player

Fixes #2217

> https://code.videolan.org/videolan/vlc-android/commit/4356d65c42dec891729c6db6951eb0e0043e9136
---

 .../src/org/videolan/vlc/gui/view/PlayerProgress.kt            | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/view/PlayerProgress.kt b/application/vlc-android/src/org/videolan/vlc/gui/view/PlayerProgress.kt
index 19d3c6eed..421c75415 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/view/PlayerProgress.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/view/PlayerProgress.kt
@@ -41,6 +41,8 @@ class PlayerProgress : View {
 
     private val progressColor = ContextCompat.getColor(context, R.color.white)
     private val boostColor = ContextCompat.getColor(context, R.color.orange700)
+    private val shadowColor = ContextCompat.getColor(context, R.color.blacktransparent)
+    private val backgroundColor = ContextCompat.getColor(context, R.color.white_transparent_50)
 
     private val paintProgress = Paint()
     private val paintBackground = Paint()
@@ -66,7 +68,7 @@ class PlayerProgress : View {
     }
 
     private fun initialize() {
-        paintBackground.color = ContextCompat.getColor(context, R.color.white_transparent_50)
+        paintBackground.color = backgroundColor
         paintBackground.isAntiAlias = true
         paintProgress.isAntiAlias = true
     }
@@ -80,6 +82,12 @@ class PlayerProgress : View {
 
         //draw background
         roundedRectanglePath(left, top, right, bottom, radius, radius)
+        paintBackground.setShadowLayer(6F,0F,0F, shadowColor)
+        canvas?.drawPath(path, paintBackground)
+        paintBackground.clearShadowLayer()
+        paintBackground.color = 0x00000000
+        canvas?.drawPath(path, paintBackground)
+        paintBackground.color = backgroundColor
         canvas?.drawPath(path, paintBackground)
 
         //draw progress



More information about the Android mailing list