[Android] GUI: add a slight shadow on top of the mini player

Adrien Maglo git at videolan.org
Fri Feb 7 12:39:56 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Feb  7 12:39:49 2014 +0100| [86dc884e86fd591655e8baa6e16ce70497b1194b] | committer: Adrien Maglo

GUI: add a slight shadow on top of the mini player

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=86dc884e86fd591655e8baa6e16ce70497b1194b
---

 vlc-android/res/drawable/mini_player_top_shadow.xml       |   13 +++++++++++++
 vlc-android/src/org/videolan/vlc/gui/MainActivity.java    |    5 ++++-
 .../src/org/videolan/vlc/widget/SlidingPaneLayout.java    |   10 +++++-----
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/vlc-android/res/drawable/mini_player_top_shadow.xml b/vlc-android/res/drawable/mini_player_top_shadow.xml
new file mode 100644
index 0000000..f2e53a7
--- /dev/null
+++ b/vlc-android/res/drawable/mini_player_top_shadow.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <gradient
+        android:angle="90"
+        android:endColor="#00000000"
+        android:startColor="@color/item_footer" />
+
+    <size
+        android:height="5dp"
+        android:width="30dp" />
+
+</shape>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index b33d141..5ebfd9c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -868,11 +868,14 @@ public class MainActivity extends SherlockFragmentActivity {
 
             @Override
             public void onPanelOpened() {
+                mSlidingPane.setShadowResource(R.drawable.mini_player_top_shadow);
                 mAudioPlayer.setHeaderVisibilities(false, false, true, true, true);
             }
 
             @Override
-            public void onPanelOpenedEntirely() {}
+            public void onPanelOpenedEntirely() {
+                mSlidingPane.setShadowDrawable(null);
+            }
 
             @Override
             public void onPanelClosed() {
diff --git a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
index 2238c99..ecdd3e0 100644
--- a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
+++ b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
@@ -748,11 +748,11 @@ public class SlidingPaneLayout extends ViewGroup {
             return;
         }
 
-        final int shadowWidth = mShadowDrawable.getIntrinsicWidth();
-        final int right = shadowView.getLeft();
-        final int top = shadowView.getTop();
-        final int bottom = shadowView.getBottom();
-        final int left = right - shadowWidth;
+        final int shadowHeight = mShadowDrawable.getIntrinsicHeight();
+        final int right = shadowView.getRight();
+        final int left = shadowView.getLeft();
+        final int bottom = shadowView.getTop();
+        final int top = bottom - shadowHeight;
         mShadowDrawable.setBounds(left, top, right, bottom);
         mShadowDrawable.draw(c);
     }



More information about the Android mailing list