[Android] [PATCH 2/3] VideoPlayerActivity: avoid libvlc calls on showOverlay

Geoffrey Métais geoffrey.metais at gmail.com
Thu Nov 6 10:16:26 CET 2014


LGTM

On Thu, Nov 6, 2014 at 10:01 AM, Thomas Guillem <thomas at gllm.fr> wrote:

> ---
>  .../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 1d072c5..c08a95e 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)
>              return;
>          mHandler.sendEmptyMessage(SHOW_PROGRESS);
> @@ -1905,11 +1910,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();
>      }
>
> --
> 2.1.1
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20141106/1e96f9e3/attachment-0001.html>


More information about the Android mailing list