diff options
author | dcalandria <dcalandria@gmail.com> | 2015-04-18 14:14:06 +0200 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-07 13:58:03 -0800 |
commit | e09c58bc8d01318ad9bf488e2de849771d40b67f (patch) | |
tree | 1571ffea6a5c2daa48b6a8a1616ef0f11fe918fc /src/com | |
parent | 3bb5aa25ecf37825ae8202664fdc145c00f46e21 (diff) | |
download | packages_apps_Browser-e09c58bc8d01318ad9bf488e2de849771d40b67f.zip packages_apps_Browser-e09c58bc8d01318ad9bf488e2de849771d40b67f.tar.gz packages_apps_Browser-e09c58bc8d01318ad9bf488e2de849771d40b67f.tar.bz2 |
Enable immersive full-screen video playback
Change-Id: I8ef22334c438b6b753e8e336af65f471446f80b4
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/BaseUi.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index 1b71e4c..939874f 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -29,6 +29,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.PaintDrawable; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -78,7 +79,7 @@ public abstract class BaseUi implements UI { private static final int MSG_HIDE_TITLEBAR = 1; private static final int MSG_HIDE_CUSTOM_VIEW = 2; public static final int HIDE_TITLEBAR_DELAY = 1500; // in ms - public static final int HIDE_CUSTOM_VIEW_DELAY = 750; // in ms + public static final int HIDE_CUSTOM_VIEW_DELAY = 200; // in ms Activity mActivity; UiController mUiController; @@ -536,7 +537,7 @@ public abstract class BaseUi implements UI { mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS); decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS); mCustomView = view; - setFullscreen(true); + setImmersiveFullscreen(true); ((BrowserWebView) getWebView()).setVisibility(View.INVISIBLE); mCustomViewCallback = callback; mActivity.setRequestedOrientation(requestedOrientation); @@ -548,7 +549,6 @@ public abstract class BaseUi implements UI { } private void hideCustomView() { - setFullscreen(false); FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView(); decor.removeView(mFullscreenContainer); mFullscreenContainer = null; @@ -559,6 +559,7 @@ public abstract class BaseUi implements UI { @Override public void onHideCustomView() { + setImmersiveFullscreen(false); ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE); if (mCustomView == null) return; @@ -797,6 +798,22 @@ public abstract class BaseUi implements UI { return (winParams.flags & bits) == bits; } + protected void setImmersiveFullscreen (boolean enabled) { + FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView(); + int systemUiVisibility = decor.getSystemUiVisibility(); + final int bits = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; + if (enabled) { + systemUiVisibility |= bits; + } else { + systemUiVisibility &= ~bits; + } + decor.setSystemUiVisibility(systemUiVisibility); + } + public Drawable getFaviconDrawable(Bitmap icon) { Drawable[] array = new Drawable[3]; array[0] = new PaintDrawable(Color.BLACK); |