summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2012-01-19 13:56:00 -0800
committerMichael Kolb <kolby@google.com>2012-05-16 13:01:32 -0700
commit8d772b03fcfd83cea6ec81c9e826f700fac88b61 (patch)
tree93897866c00fd2561569af8cf5cf961cdb4db5e7
parent234eadcf7d0dbf2d24f92c24f40343d518f6fe3a (diff)
downloadpackages_apps_browser-8d772b03fcfd83cea6ec81c9e826f700fac88b61.zip
packages_apps_browser-8d772b03fcfd83cea6ec81c9e826f700fac88b61.tar.gz
packages_apps_browser-8d772b03fcfd83cea6ec81c9e826f700fac88b61.tar.bz2
Add setting to control tabs per app behavior
Bug: 5890701 Change-Id: I6a47c7bff260dd8ded3a4c360f186ce8f670c67e
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml-sw600dp/advanced_preferences.xml98
-rw-r--r--res/xml/advanced_preferences.xml7
-rw-r--r--src/com/android/browser/BrowserSettings.java4
-rw-r--r--src/com/android/browser/IntentHandler.java3
-rw-r--r--src/com/android/browser/PreferenceKeys.java1
6 files changed, 113 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 90ec428..7df2a91 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -284,6 +284,8 @@
<string name="menu_preferences">Settings</string>
<!-- Settings screen, section title -->
<string name="pref_content_title">Page content</string>
+ <!-- Settings label [CHAR LIMIT=40]-->
+ <string name="pref_allow_apptabs">Allow multiple tabs per app</string>
<!-- Settings label -->
<string name="pref_content_load_images">Load images</string>
<!-- Settings label -->
diff --git a/res/xml-sw600dp/advanced_preferences.xml b/res/xml-sw600dp/advanced_preferences.xml
new file mode 100644
index 0000000..73f145b
--- /dev/null
+++ b/res/xml-sw600dp/advanced_preferences.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <!-- Entries and values in this list are set dynamically. -->
+ <com.android.browser.search.SearchEnginePreference
+ android:key="search_engine"
+ android:title="@string/pref_content_search_engine"
+ android:defaultValue="google"
+ android:summary="@string/pref_content_search_engine_summary"
+ android:dialogTitle="@string/pref_content_search_engine" />
+
+ <CheckBoxPreference
+ android:key="open_in_background"
+ android:defaultValue="false"
+ android:title="@string/pref_content_open_in_background"
+ android:summary="@string/pref_content_open_in_background_summary" />
+
+ <CheckBoxPreference
+ android:key="enable_javascript"
+ android:defaultValue="true"
+ android:title="@string/pref_content_javascript" />
+
+ <ListPreference
+ android:key="plugin_state"
+ android:title="@string/pref_content_plugins"
+ android:defaultValue="ON"
+ android:entries="@array/pref_content_plugins_choices"
+ android:entryValues="@array/pref_content_plugins_values"
+ android:dialogTitle="@string/pref_content_plugins" />
+
+ <PreferenceScreen
+ android:key="website_settings"
+ android:title="@string/pref_extras_website_settings"
+ android:summary="@string/pref_extras_website_settings_summary" />
+
+ <PreferenceCategory android:title="@string/pref_content_title">
+
+ <ListPreference
+ android:key="default_zoom"
+ android:title="@string/pref_default_zoom"
+ android:defaultValue="MEDIUM"
+ android:entries="@array/pref_default_zoom_choices"
+ android:entryValues="@array/pref_default_zoom_values"
+ android:dialogTitle="@string/pref_default_zoom_dialogtitle" />
+
+ <CheckBoxPreference
+ android:key="load_page"
+ android:defaultValue="true"
+ android:title="@string/pref_content_load_page"
+ android:summary="@string/pref_content_load_page_summary" />
+
+ <CheckBoxPreference
+ android:key="autofit_pages"
+ android:defaultValue="true"
+ android:title="@string/pref_content_autofit"
+ android:summary="@string/pref_content_autofit_summary" />
+
+ <CheckBoxPreference
+ android:key="block_popup_windows"
+ android:defaultValue="true"
+ android:title="@string/pref_content_block_popups" />
+
+ <ListPreference
+ android:key="default_text_encoding"
+ android:title="@string/pref_default_text_encoding"
+ android:defaultValue="@string/pref_default_text_encoding_default"
+ android:entries="@array/pref_default_text_encoding_choices"
+ android:entryValues="@array/pref_default_text_encoding_values"
+ android:dialogTitle="@string/pref_default_text_encoding_dialogtitle" />
+
+ </PreferenceCategory>
+
+ <PreferenceCategory android:title="@string/pref_extras_reset_default_title">
+ <com.android.browser.BrowserYesNoPreference
+ android:key="reset_default_preferences"
+ android:title="@string/pref_extras_reset_default"
+ android:summary="@string/pref_extras_reset_default_summary"
+ android:dialogMessage="@string/pref_extras_reset_default_dlg"
+ android:dialogIcon="@android:drawable/ic_dialog_alert" />
+ </PreferenceCategory>
+
+</PreferenceScreen>
diff --git a/res/xml/advanced_preferences.xml b/res/xml/advanced_preferences.xml
index 4c5ecdf..e292b7d 100644
--- a/res/xml/advanced_preferences.xml
+++ b/res/xml/advanced_preferences.xml
@@ -36,6 +36,11 @@
android:defaultValue="true"
android:title="@string/pref_content_javascript" />
+ <CheckBoxPreference
+ android:key="allow_apptabs"
+ android:defaultValue="false"
+ android:title="@string/pref_allow_apptabs" />
+
<ListPreference
android:key="plugin_state"
android:title="@string/pref_content_plugins"
@@ -91,7 +96,7 @@
android:key="reset_default_preferences"
android:title="@string/pref_extras_reset_default"
android:summary="@string/pref_extras_reset_default_summary"
- android:dialogMessage="@string/pref_extras_reset_default_dlg"
+ android:dialogMessage="@string/pref_extras_reset_default_dlg"
android:dialogIcon="@android:drawable/ic_dialog_alert" />
</PreferenceCategory>
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 0b7e87a..8dfd4d7 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -652,6 +652,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return mPrefs.getString(PREF_SEARCH_ENGINE, SearchEngine.GOOGLE);
}
+ public boolean allowAppTabs() {
+ return mPrefs.getBoolean(PREF_ALLOW_APP_TABS, false);
+ }
+
public boolean openInBackground() {
return mPrefs.getBoolean(PREF_OPEN_IN_BACKGROUND, false);
}
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index 47cab70..e22c5dc 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -139,7 +139,8 @@ public class IntentHandler {
}
if (Intent.ACTION_VIEW.equals(action)
&& !mActivity.getPackageName().equals(appId)) {
- if (!BrowserActivity.isTablet(mActivity)) {
+ if (!BrowserActivity.isTablet(mActivity)
+ && !mSettings.allowAppTabs()) {
Tab appTab = mTabControl.getTabFromAppId(appId);
if (appTab != null) {
mController.reuseTab(appTab, urlData);
diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java
index ff42aaf..1828032 100644
--- a/src/com/android/browser/PreferenceKeys.java
+++ b/src/com/android/browser/PreferenceKeys.java
@@ -46,6 +46,7 @@ public interface PreferenceKeys {
static final String PREF_RESET_DEFAULT_PREFERENCES = "reset_default_preferences";
static final String PREF_SEARCH_ENGINE = "search_engine";
static final String PREF_WEBSITE_SETTINGS = "website_settings";
+ static final String PREF_ALLOW_APP_TABS = "allow_apptabs";
// ----------------------
// Keys for debug_preferences.xml