From c07003d543a9b2b28dd152372e5355789ef1772e Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Mon, 14 May 2012 17:19:56 +0800 Subject: Fix 6479216 Playing a video should go full-screen first Change-Id: I7b1d2bd28531ec4fd4b65862122cf058ef69066e b: 6479216 --- src/com/android/gallery3d/app/MoviePlayer.java | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java index 3de534b97..2c8f9eb36 100644 --- a/src/com/android/gallery3d/app/MoviePlayer.java +++ b/src/com/android/gallery3d/app/MoviePlayer.java @@ -83,6 +83,9 @@ public class MoviePlayer implements // If the time bar is visible. private boolean mShowing; + // Control when system UI can be shown + private boolean mAllowShowingSystemUI; + private final Runnable mPlayingChecker = new Runnable() { @Override public void run() { @@ -127,16 +130,20 @@ public class MoviePlayer implements // When the user touches the screen or uses some hard key, the framework // will change system ui visibility from invisible to visible. We show - // the media control at this point. + // the media control and enable system UI (e.g. ActionBar) to be visible at this point mVideoView.setOnSystemUiVisibilityChangeListener( new View.OnSystemUiVisibilityChangeListener() { public void onSystemUiVisibilityChange(int visibility) { if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) { + mAllowShowingSystemUI = true; mController.show(); } } }); + // Hide system UI by default + showSystemUi(false); + mAudioBecomingNoisyReceiver = new AudioBecomingNoisyReceiver(); mAudioBecomingNoisyReceiver.register(); @@ -164,6 +171,11 @@ public class MoviePlayer implements int flag = visible ? 0 : View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LOW_PROFILE; mVideoView.setSystemUiVisibility(flag); + if (visible) { + mActionBar.show(); + } else { + mActionBar.hide(); + } } public void onSaveInstanceState(Bundle outState) { @@ -317,15 +329,18 @@ public class MoviePlayer implements @Override public void onShown() { mShowing = true; - mActionBar.show(); - showSystemUi(true); setProgress(); + + // System UI is invisible by default until the flag is set by user interaction + // See VideoView's onSystemUiVisibilityChange listener for details. + if (mAllowShowingSystemUI) { + showSystemUi(true); + } } @Override public void onHidden() { mShowing = false; - mActionBar.hide(); showSystemUi(false); } -- cgit v1.2.3