[Android] Audio browser: add a method to force the mini player to keep hidden

Adrien Maglo git at videolan.org
Wed Nov 27 14:26:28 CET 2013


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Nov 26 16:21:26 2013 +0100| [6eb18e02707e165fb346053c14ef157f1bcd7660] | committer: Adrien Maglo

Audio browser: add a method to force the mini player to keep hidden

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java     |    9 +++++++++
 .../src/org/videolan/vlc/widget/AudioMiniPlayer.java       |   12 +++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 05aa7ab..efc51b4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -726,4 +726,13 @@ public class MainActivity extends SherlockFragmentActivity {
                 }});
         b.show();
     }
+
+    /**
+     * Tell the mini player to keep hidden or not.
+     * @param k true if the player must keep hidden, else false.
+     */
+    public void setMiniPlayerKeepHidden(boolean k)
+    {
+        mAudioPlayer.setKeepHidden(k);
+    }
 }
diff --git a/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java b/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
index 49ff957..c4bbe08 100644
--- a/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
@@ -180,7 +180,7 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
     public synchronized void update() {
         if (mAudioPlayerControl != null && getActivity() != null) {
 
-            if (mAudioPlayerControl.hasMedia()) {
+            if (mAudioPlayerControl.hasMedia() && !mKeepHidden) {
                 show();
             } else {
                 hide();
@@ -244,4 +244,14 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
         ft.commit();
     }
 
+    private boolean mKeepHidden = false;
+
+    /**
+     * Tell the mini player to keep hidden or not.
+     * @param k true if the player must keep hidden, else false.
+     */
+    public void setKeepHidden(boolean k) {
+        mKeepHidden = k;
+        update();
+    }
 }



More information about the Android mailing list