[Android] VideoPlayerActivity: avoid libvlc calls on showOverlay

Thomas Guillem git at videolan.org
Thu Nov 6 19:09:00 CET 2014


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov  6 10:01:06 2014 +0100| [b2077e21fb85b6c27de1e697cff586196d648168] | committer: Geoffrey Métais

VideoPlayerActivity: avoid libvlc calls on showOverlay

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

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

 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 77acae4..12d062f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -191,6 +191,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
     private boolean mIsLocked = false;
     private int mLastAudioTrack = -1;
     private int mLastSpuTrack = -2;
+    private int mOverlayTimeout = 0;
 
     /**
      * For uninterrupted switching between audio and video mode
@@ -1872,7 +1873,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
      * show overlay the the default timeout
      */
     private void showOverlay() {
-        showOverlay(mLibVLC.isPlaying() ? OVERLAY_TIMEOUT : OVERLAY_INFINITE);
+        showOverlay(0);
     }
 
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@@ -1887,6 +1888,10 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
      * show overlay
      */
     private void showOverlay(int timeout) {
+        if (timeout != 0)
+            mOverlayTimeout = timeout;
+        if (mOverlayTimeout == 0)
+            mOverlayTimeout = mLibVLC.isPlaying() ? OVERLAY_TIMEOUT : OVERLAY_INFINITE;
         if (mIsNavMenu){
             mShowing = true;
             return;
@@ -1907,11 +1912,9 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
             mOverlayProgress.setVisibility(View.VISIBLE);
             if (mPresentation != null) mOverlayBackground.setVisibility(View.VISIBLE);
         }
-        if (timeout != 0) {
-            mHandler.removeMessages(FADE_OUT);
-            if (timeout != OVERLAY_INFINITE)
-                mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), timeout);
-        }
+        mHandler.removeMessages(FADE_OUT);
+        if (mOverlayTimeout != OVERLAY_INFINITE)
+            mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), mOverlayTimeout);
         updateOverlayPausePlay();
     }
 



More information about the Android mailing list