summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNebojsa Cvetkovic <nebkat@teamhacksung.org>2012-09-12 22:24:22 +0200
committerSteve Kondik <steve@cyngn.com>2015-11-07 13:57:35 -0800
commit3638ddea7cd37b71d0026e0c1ee204a5b51b6876 (patch)
tree88549d887df290419cc0afb9690da67a32697c6f /src
parentd62ce4c42fee9316462dd397fb0ebc0ac86d7a70 (diff)
downloadpackages_apps_Browser-3638ddea7cd37b71d0026e0c1ee204a5b51b6876.zip
packages_apps_Browser-3638ddea7cd37b71d0026e0c1ee204a5b51b6876.tar.gz
packages_apps_Browser-3638ddea7cd37b71d0026e0c1ee204a5b51b6876.tar.bz2
Add fullscreen toggle to menu
Change-Id: I7acecfc32dde250685f96354b45a91b93667114e
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/BaseUi.java9
-rw-r--r--src/com/android/browser/BrowserSettings.java8
-rw-r--r--src/com/android/browser/Controller.java12
-rw-r--r--src/com/android/browser/PhoneUi.java4
-rw-r--r--src/com/android/browser/UI.java2
-rw-r--r--src/com/android/browser/UiController.java2
6 files changed, 28 insertions, 9 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index b9f61e3..1b71e4c 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -138,7 +138,7 @@ public abstract class BaseUi implements UI {
R.id.fullscreen_custom_content);
mErrorConsoleContainer = (LinearLayout) frameLayout
.findViewById(R.id.error_console);
- setFullscreen(BrowserSettings.getInstance().useFullscreen());
+ setFullscreen(false);
mGenericFavicon = res.getDrawable(
R.drawable.app_web_browser_sm);
mTitleBar = new TitleBar(mActivity, mUiController, this,
@@ -790,6 +790,13 @@ public abstract class BaseUi implements UI {
win.setAttributes(winParams);
}
+ public boolean isFullscreen() {
+ Window win = mActivity.getWindow();
+ WindowManager.LayoutParams winParams = win.getAttributes();
+ final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ return (winParams.flags & bits) == bits;
+ }
+
public Drawable getFaviconDrawable(Bitmap icon) {
Drawable[] array = new Drawable[3];
array[0] = new PaintDrawable(Color.BLACK);
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 8138bc2..370f764 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -340,10 +340,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
syncManagedSettings();
if (PREF_SEARCH_ENGINE.equals(key)) {
updateSearchEngine(false);
- } else if (PREF_FULLSCREEN.equals(key)) {
- if (mController != null && mController.getUi() != null) {
- mController.getUi().setFullscreen(useFullscreen());
- }
} else if (PREF_ENABLE_QUICK_CONTROLS.equals(key)) {
if (mController != null && mController.getUi() != null) {
mController.getUi().setUseQuickControls(sharedPreferences.getBoolean(key, false));
@@ -777,10 +773,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return HomeProvider.MOST_VISITED.equals(getHomePage());
}
- public boolean useFullscreen() {
- return mPrefs.getBoolean(PREF_FULLSCREEN, false);
- }
-
public boolean useInvertedRendering() {
return mPrefs.getBoolean(PREF_INVERTED, false);
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index ebc2c90..8c77270 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1585,6 +1585,10 @@ public class Controller
boolean showDebugSettings = mSettings.isDebugEnabled();
final MenuItem uaSwitcher = menu.findItem(R.id.ua_desktop_menu_id);
uaSwitcher.setChecked(isDesktopUa);
+
+ final MenuItem fullscreen = menu.findItem(R.id.fullscreen_menu_id);
+ fullscreen.setChecked(mUi.isFullscreen());
+
menu.setGroupVisible(R.id.LIVE_MENU, isLive);
menu.setGroupVisible(R.id.SNAPSHOT_MENU, !isLive);
menu.setGroupVisible(R.id.COMBO_MENU, false);
@@ -1712,6 +1716,9 @@ public class Controller
toggleUserAgent();
break;
+ case R.id.fullscreen_menu_id:
+ toggleFullscreen();
+
case R.id.window_one_menu_id:
case R.id.window_two_menu_id:
case R.id.window_three_menu_id:
@@ -1749,6 +1756,11 @@ public class Controller
}
@Override
+ public void toggleFullscreen() {
+ mUi.setFullscreen(!mUi.isFullscreen());
+ }
+
+ @Override
public void findOnPage() {
getCurrentTopWebView().showFindDialog(null, true);
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 7b6da07..32bbc6b 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -196,6 +196,10 @@ public class PhoneUi extends BaseUi {
}
closeOthers.setEnabled(!isLastTab);
}
+ MenuItem fullscreen = menu.findItem(R.id.fullscreen_menu_id);
+ if (fullscreen != null) {
+ fullscreen.setVisible(!showingNavScreen());
+ }
if (showingNavScreen()) {
menu.setGroupVisible(R.id.LIVE_MENU, false);
menu.setGroupVisible(R.id.SNAPSHOT_MENU, false);
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index 677c3d3..d9bb3bc 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -142,6 +142,8 @@ public interface UI {
void setFullscreen(boolean enabled);
+ boolean isFullscreen();
+
void setUseQuickControls(boolean enabled);
public boolean shouldCaptureThumbnails();
diff --git a/src/com/android/browser/UiController.java b/src/com/android/browser/UiController.java
index f00f1a2..643fb40 100644
--- a/src/com/android/browser/UiController.java
+++ b/src/com/android/browser/UiController.java
@@ -105,6 +105,8 @@ public interface UiController {
void toggleUserAgent();
+ void toggleFullscreen();
+
BrowserSettings getSettings();
boolean supportsVoice();