From c38c604eca3bd0620cd9284187aace78455e723d Mon Sep 17 00:00:00 2001 From: Michael Kolb Date: Wed, 27 Apr 2011 10:46:06 -0700 Subject: add fullscreen option Change-Id: I88299c37a7e809492f806478f41365b56b2687be --- res/values/strings.xml | 5 +++++ res/xml/lab_preferences.xml | 5 +++++ src/com/android/browser/BaseUi.java | 12 ++++++++++++ src/com/android/browser/BrowserSettings.java | 9 +++++++++ src/com/android/browser/PreferenceKeys.java | 1 + src/com/android/browser/UI.java | 2 ++ 6 files changed, 34 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index c30eea8..63f5aef 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -647,6 +647,11 @@ Use Google Instant when you use Google Search, to show results as you type (this can increase data use). + Fullscreen + + + Use fullscreen mode to hide the status bar. + Data connectivity problem diff --git a/res/xml/lab_preferences.xml b/res/xml/lab_preferences.xml index b33052f..ee00463 100644 --- a/res/xml/lab_preferences.xml +++ b/res/xml/lab_preferences.xml @@ -26,4 +26,9 @@ android:defaultValue="false" android:title="@string/pref_lab_most_visited_homepage" android:summary="@string/pref_lab_most_visited_homepage_summary" /> + diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index 5bb4c1f..e2e313e 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -116,6 +116,7 @@ public abstract class BaseUi implements UI, WebViewFactory { mCustomViewContainer = (FrameLayout) mBrowserFrameLayout .findViewById(R.id.fullscreen_custom_content); frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS); + setFullscreen(BrowserSettings.getInstance().useFullscreen()); } @Override @@ -783,4 +784,15 @@ public abstract class BaseUi implements UI, WebViewFactory { return menu; } + public void setFullscreen(boolean enabled) { + if (enabled) { + mActivity.getWindow().setFlags( + WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } else { + mActivity.getWindow().clearFlags( + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + } + } diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index 9456561..eadd57e 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -218,6 +218,11 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, if (PREF_USE_INSTANT_SEARCH.equals(key)) { updateSearchEngine(true); } + if (PREF_FULLSCREEN.equals(key)) { + if (mController.getUi() != null) { + mController.getUi().setFullscreen(useFullscreen()); + } + } } static String getFactoryResetHomeUrl(Context context) { @@ -556,6 +561,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, return mPrefs.getBoolean(PREF_USE_INSTANT_SEARCH, false); } + public boolean useFullscreen() { + return mPrefs.getBoolean(PREF_FULLSCREEN, false); + } + // ----------------------------- // getter/setters for privacy_security_preferences.xml // ----------------------------- diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java index 929339f..b4c4a68 100644 --- a/src/com/android/browser/PreferenceKeys.java +++ b/src/com/android/browser/PreferenceKeys.java @@ -76,6 +76,7 @@ public interface PreferenceKeys { static final String PREF_ENABLE_QUICK_CONTROLS = "enable_quick_controls"; static final String PREF_USE_MOST_VISITED_HOMEPAGE = "use_most_visited_homepage"; static final String PREF_USE_INSTANT_SEARCH = "use_instant_search"; + static final String PREF_FULLSCREEN = "fullscreen"; // ---------------------- // Keys for privacy_security_preferences.xml diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java index 40fc14a..bb34ada 100644 --- a/src/com/android/browser/UI.java +++ b/src/com/android/browser/UI.java @@ -132,4 +132,6 @@ public interface UI { void showAutoLogin(Tab tab); void hideAutoLogin(Tab tab); + + void setFullscreen(boolean enabled); } -- cgit v1.1