diff options
author | Michael Kolb <kolby@google.com> | 2011-12-05 09:24:25 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-05 09:24:25 -0800 |
commit | 277cbe5a951840558166020568fb1510285e2594 (patch) | |
tree | 6aba82927431e36ebd8202fad25c48ffe0fdddb9 | |
parent | f57c1388860486a70cc773f2cfeaa3ea3b38a473 (diff) | |
parent | c07b678522b46e77a2817e9749fe6d32b28af700 (diff) | |
download | frameworks_base-277cbe5a951840558166020568fb1510285e2594.zip frameworks_base-277cbe5a951840558166020568fb1510285e2594.tar.gz frameworks_base-277cbe5a951840558166020568fb1510285e2594.tar.bz2 |
Merge "set System UI visibility based on MediaController state" into ics-mr1
-rw-r--r-- | core/java/android/webkit/HTML5VideoFullScreen.java | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java index cb555ea..e1eff58 100644 --- a/core/java/android/webkit/HTML5VideoFullScreen.java +++ b/core/java/android/webkit/HTML5VideoFullScreen.java @@ -4,15 +4,12 @@ package android.webkit; import android.content.Context; import android.media.MediaPlayer; import android.media.Metadata; -import android.util.Log; import android.view.Gravity; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.ViewGroup; -import android.webkit.HTML5VideoView; -import android.webkit.HTML5VideoViewProxy; import android.widget.FrameLayout; import android.widget.MediaController; import android.widget.MediaController.MediaPlayerControl; @@ -150,7 +147,7 @@ public class HTML5VideoFullScreen extends HTML5VideoView private void prepareForFullScreen() { // So in full screen, we reset the MediaPlayer mPlayer.reset(); - MediaController mc = new MediaController(mProxy.getContext()); + MediaController mc = new FullScreenMediaController(mProxy.getContext(), mLayout); mc.setSystemUiVisibility(mLayout.getSystemUiVisibility()); setMediaController(mc); mPlayer.setScreenOnWhilePlaying(true); @@ -261,9 +258,6 @@ public class HTML5VideoFullScreen extends HTML5VideoView mLayout.addView(getSurfaceView(), layoutParams); mLayout.setVisibility(View.VISIBLE); - mLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); - WebChromeClient client = webView.getWebChromeClient(); if (client != null) { client.onShowCustomView(mLayout, mCallback); @@ -340,4 +334,33 @@ public class HTML5VideoFullScreen extends HTML5VideoView } return; } + + static class FullScreenMediaController extends MediaController { + + View mVideoView; + + public FullScreenMediaController(Context context, View video) { + super(context); + mVideoView = video; + } + + @Override + public void show() { + super.show(); + if (mVideoView != null) { + mVideoView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + } + } + + @Override + public void hide() { + if (mVideoView != null) { + mVideoView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); + } + super.hide(); + } + + } + } |