diff options
author | Ray Chen <raychen@google.com> | 2012-05-14 17:19:56 +0800 |
---|---|---|
committer | Ray Chen <raychen@google.com> | 2012-05-14 17:22:15 +0800 |
commit | c07003d543a9b2b28dd152372e5355789ef1772e (patch) | |
tree | 7b66bdfefcf64cb843a0b6d9961d108c3f58262a /src/com/android/gallery3d/app/MoviePlayer.java | |
parent | 9617f47a1b307299d98644f54ea5b20839dae615 (diff) | |
download | android_packages_apps_Snap-c07003d543a9b2b28dd152372e5355789ef1772e.tar.gz android_packages_apps_Snap-c07003d543a9b2b28dd152372e5355789ef1772e.tar.bz2 android_packages_apps_Snap-c07003d543a9b2b28dd152372e5355789ef1772e.zip |
Fix 6479216 Playing a video should go full-screen first
Change-Id: I7b1d2bd28531ec4fd4b65862122cf058ef69066e
b: 6479216
Diffstat (limited to 'src/com/android/gallery3d/app/MoviePlayer.java')
-rw-r--r-- | src/com/android/gallery3d/app/MoviePlayer.java | 23 |
1 files changed, 19 insertions, 4 deletions
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); } |