[Android] Audio player: slide up and down the audio player when its header is clicked

Adrien Maglo git at videolan.org
Mon Feb 3 21:57:20 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Feb  3 21:56:43 2014 +0100| [6ddb52db218032bddfbdf29e5a445d892522a722] | committer: Adrien Maglo

Audio player: slide up and down the audio player when its header is clicked

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java       |   10 ++++++++++
 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java  |    9 +++++++++
 .../src/org/videolan/vlc/widget/AudioMediaSwitcher.java      |    4 ++++
 3 files changed, 23 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index cf23721..b33d141 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -843,6 +843,16 @@ public class MainActivity extends SherlockFragmentActivity {
     }
 
     /**
+     * Slide up and down the audio player depending on its current state.
+     */
+    public void slideUpOrDownAudioPlayer() {
+        if (mSlidingPane.getState() == mSlidingPane.STATE_CLOSED)
+            mSlidingPane.openPane();
+        else if (mSlidingPane.getState() == mSlidingPane.STATE_OPENED)
+            mSlidingPane.closePane();
+    }
+
+    /**
      * Hide the audio player.
      */
     public void hideAudioPlayer() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 440b02d..d1db3a4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -526,6 +526,12 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
         public void onTouchUp() {
             restoreHedaderButtonVisibilities();
         }
+
+        @Override
+        public void onTouchClick() {
+            MainActivity activity = (MainActivity)getActivity();
+            activity.slideUpOrDownAudioPlayer();
+        }
     };
 
     private final AudioMediaSwitcherListener mCoverMediaSwitcherListener = new AudioMediaSwitcherListener() {
@@ -546,6 +552,9 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
 
         @Override
         public void onTouchUp() {}
+
+        @Override
+        public void onTouchClick() {}
     };
 
 }
diff --git a/vlc-android/src/org/videolan/vlc/widget/AudioMediaSwitcher.java b/vlc-android/src/org/videolan/vlc/widget/AudioMediaSwitcher.java
index 5e588c8..8fec80e 100644
--- a/vlc-android/src/org/videolan/vlc/widget/AudioMediaSwitcher.java
+++ b/vlc-android/src/org/videolan/vlc/widget/AudioMediaSwitcher.java
@@ -120,6 +120,8 @@ public abstract class AudioMediaSwitcher extends FlingViewGroup {
 
         @Override
         public void onTouchClick() {
+            if (mAudioMediaSwitcherListener != null)
+                mAudioMediaSwitcherListener.onTouchClick();
         }
     };
 
@@ -139,5 +141,7 @@ public abstract class AudioMediaSwitcher extends FlingViewGroup {
         void onTouchDown();
 
         void onTouchUp();
+
+        void onTouchClick();
     }
 }



More information about the Android mailing list