summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/BaseUi.java33
-rw-r--r--src/com/android/browser/BrowserSettings.java44
-rw-r--r--src/com/android/browser/Controller.java80
-rw-r--r--src/com/android/browser/NavScreen.java64
-rw-r--r--src/com/android/browser/NavTabView.java5
-rw-r--r--src/com/android/browser/NetworkStateHandler.java18
-rw-r--r--src/com/android/browser/PhoneUi.java4
-rw-r--r--src/com/android/browser/PreferenceKeys.java3
-rw-r--r--src/com/android/browser/UI.java2
-rw-r--r--src/com/android/browser/UiController.java2
-rw-r--r--src/com/android/browser/preferences/BandwidthPreferencesFragment.java10
-rw-r--r--src/com/android/browser/preferences/LabPreferencesFragment.java9
12 files changed, 249 insertions, 25 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index b766fb9..1165c53 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +77,9 @@ public abstract class BaseUi implements UI {
Gravity.CENTER);
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
Activity mActivity;
UiController mUiController;
@@ -540,22 +543,31 @@ public abstract class BaseUi implements UI {
mActivity.setRequestedOrientation(requestedOrientation);
}
- @Override
- public void onHideCustomView() {
- ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE);
- if (mCustomView == null)
- return;
+ private void hideCustomViewAfterDuration() {
+ Message msg = Message.obtain(mHandler, MSG_HIDE_CUSTOM_VIEW);
+ mHandler.sendMessageDelayed(msg, HIDE_CUSTOM_VIEW_DELAY);
+ }
+
+ private void hideCustomView() {
setFullscreen(false);
FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
decor.removeView(mFullscreenContainer);
mFullscreenContainer = null;
mCustomView = null;
- mCustomViewCallback.onCustomViewHidden();
// Show the content view.
mActivity.setRequestedOrientation(mOriginalOrientation);
}
@Override
+ public void onHideCustomView() {
+ ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE);
+ if (mCustomView == null)
+ return;
+ mCustomViewCallback.onCustomViewHidden();
+ hideCustomViewAfterDuration();
+ }
+
+ @Override
public boolean isCustomViewShowing() {
return mCustomView != null;
}
@@ -779,6 +791,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);
@@ -827,6 +846,8 @@ public abstract class BaseUi implements UI {
public void handleMessage(Message msg) {
if (msg.what == MSG_HIDE_TITLEBAR) {
suggestHideTitleBar();
+ } else if (msg.what == MSG_HIDE_CUSTOM_VIEW) {
+ hideCustomView();
}
BaseUi.this.handleMessage(msg);
}
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 4555c18..8dadfc8 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (c) 2011, 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,6 +130,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
private static String sFactoryResetUrl;
+ private static boolean sWebGLAvailable;
+
public static void initialize(final Context context) {
sInstance = new BrowserSettings(context);
}
@@ -275,6 +278,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
settings.setSaveFormData(saveFormdata());
settings.setUseWideViewPort(isWideViewport());
settings.setAutoFillProfile(getAutoFillProfile());
+ setIsWebGLAvailable(settings.isWebGLAvailable());
+ settings.setWebGLEnabled(isWebGLAvailable() && isWebGLEnabled());
String ua = mCustomUserAgents.get(settings);
if (ua != null) {
@@ -657,6 +662,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return mPrefs.getString(PREF_SEARCH_ENGINE, SearchEngine.GOOGLE);
}
+ public int getUserAgent() {
+ return Integer.parseInt(mPrefs.getString(PREF_USER_AGENT, "0"));
+ }
+
public boolean allowAppTabs() {
return mPrefs.getBoolean(PREF_ALLOW_APP_TABS, false);
}
@@ -739,13 +748,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return mPrefs.getBoolean(PREF_ENABLE_HARDWARE_ACCEL_SKIA, false);
}
- public int getUserAgent() {
- if (!isDebugEnabled()) {
- return 0;
- }
- return Integer.parseInt(mPrefs.getString(PREF_USER_AGENT, "0"));
- }
-
// -----------------------------
// getter/setters for hidden_debug_preferences.xml
// -----------------------------
@@ -844,6 +846,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return 1 + (mPrefs.getInt(PREF_INVERTED_CONTRAST, 0) / 10f);
}
+ public boolean isWebGLEnabled() {
+ return mPrefs.getBoolean(PREF_ENABLE_WEBGL, true);
+ }
+
// -----------------------------
// getter/setters for privacy_security_preferences.xml
// -----------------------------
@@ -920,6 +926,30 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return mPrefs.getString(PREF_LINK_PREFETCH, getDefaultLinkPrefetchSetting());
}
+ public String getVideoPreloadOnWifiOnlyPreferenceString() {
+ return mContext.getResources().getString(R.string.pref_video_preload_value_wifi_only);
+ }
+
+ public String getVideoPreloadAlwaysPreferenceString() {
+ return mContext.getResources().getString(R.string.pref_video_preload_value_always);
+ }
+
+ public String getDefaultVideoPreloadSetting() {
+ return mContext.getResources().getString(R.string.pref_video_preload_default_value);
+ }
+
+ public String getVideoPreloadEnabled() {
+ return mPrefs.getString(PREF_VIDEO_PRELOAD, getDefaultVideoPreloadSetting());
+ }
+
+ private static void setIsWebGLAvailable(boolean available) {
+ sWebGLAvailable = available;
+ }
+
+ public static boolean isWebGLAvailable() {
+ return sWebGLAvailable;
+ }
+
// -----------------------------
// getter/setters for browser recovery
// -----------------------------
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 846d41f..2b449ec 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
+ * Copyright (c) 2011, 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -504,8 +505,9 @@ public class Controller
break;
case R.id.open_newtab_context_menu_id:
final Tab parent = mTabControl.getCurrentTab();
- openTab(url, parent,
- !mSettings.openInBackground(), true);
+ boolean privateBrowsing = msg.arg2 == 1;
+ openTab(url, parent != null && privateBrowsing,
+ !mSettings.openInBackground(), true, parent);
break;
case R.id.copy_link_context_menu_id:
copy(url);
@@ -832,6 +834,15 @@ public class Controller
view.setNetworkAvailable(false);
}
+ WebSettings settings = view.getSettings();
+ String preload = mSettings.getVideoPreloadEnabled();
+ if (mSettings.getVideoPreloadAlwaysPreferenceString().equals(preload))
+ settings.setMediaPreloadEnabled(true);
+ else if (mSettings.getVideoPreloadOnWifiOnlyPreferenceString().equals(preload))
+ settings.setMediaPreloadEnabled(mNetworkHandler.isWifiUp());
+ else
+ settings.setMediaPreloadEnabled(false);
+
// when BrowserActivity just starts, onPageStarted may be called before
// onResume as it is triggered from onCreate. Call resumeWebViewTimers
// to start the timer. As we won't switch tabs while an activity is in
@@ -1406,6 +1417,42 @@ public class Controller
});
}
}
+ newTabItem = menu.findItem(R.id.open_newtab_incognito_context_menu_id);
+ newTabItem.setTitle(getSettings().openInBackground()
+ ? R.string.contextmenu_openlink_incognito_newwindow_background
+ : R.string.contextmenu_openlink_incognito_newwindow);
+ newTabItem.setVisible(showNewTab);
+ newTabItem.setVisible(!mTabControl.getCurrentTab().isPrivateBrowsingEnabled());
+ if (showNewTab) {
+ if (WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE == type) {
+ newTabItem.setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ final HashMap<String, WebView> hrefMap =
+ new HashMap<String, WebView>();
+ hrefMap.put("webview", webview);
+ final Message msg = mHandler.obtainMessage(
+ FOCUS_NODE_HREF,
+ R.id.open_newtab_context_menu_id,
+ 1, hrefMap);
+ webview.requestFocusNodeHref(msg);
+ return true;
+ }
+ });
+ } else {
+ newTabItem.setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ final Tab parent = mTabControl.getCurrentTab();
+ openTab(extra, parent != null,
+ !mSettings.openInBackground(), true, parent);
+ return true;
+ }
+ });
+ }
+ }
if (type == WebView.HitTestResult.SRC_ANCHOR_TYPE) {
break;
}
@@ -1547,6 +1594,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);
@@ -1684,6 +1735,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:
@@ -1784,6 +1838,11 @@ public class Controller
}
@Override
+ public void toggleFullscreen() {
+ mUi.setFullscreen(!mUi.isFullscreen());
+ }
+
+ @Override
public void findOnPage() {
getCurrentTopWebView().showFindDialog(null, true);
}
@@ -2859,11 +2918,18 @@ public class Controller
@Override
public void startVoiceRecognizer() {
- Intent voice = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
- voice.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
- voice.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
- mActivity.startActivityForResult(voice, VOICE_RESULT);
+ try{
+ Intent voice = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
+ voice.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
+ RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
+ voice.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
+ mActivity.startActivityForResult(voice, VOICE_RESULT);
+ }
+ catch(android.content.ActivityNotFoundException ex)
+ {
+ //if could not find the Activity
+ Log.e(LOGTAG, "Could not start voice recognizer activity");
+ }
}
@Override
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index 1d2114e..ae0a338 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -19,6 +19,7 @@ package com.android.browser;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
+import android.graphics.Point;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
@@ -26,6 +27,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ImageButton;
@@ -42,6 +44,7 @@ import com.android.browser.TabControl.OnThumbnailUpdatedListener;
import com.android.browser.UI.ComboViews;
import java.util.HashMap;
+import java.util.List;
public class NavScreen extends RelativeLayout
implements OnClickListener, OnMenuItemClickListener, OnThumbnailUpdatedListener {
@@ -56,6 +59,8 @@ public class NavScreen extends RelativeLayout
ImageButton mForward;
ImageButton mBookmarks;
ImageButton mMore;
+ ImageButton mHomeTab;
+ ImageButton mNewIncognitoTab;
ImageButton mNewTab;
FrameLayout mHolder;
@@ -66,6 +71,7 @@ public class NavScreen extends RelativeLayout
NavTabScroller mScroller;
TabAdapter mAdapter;
int mOrientation;
+ Point mSize;
boolean mNeedsMenu;
HashMap<Tab, View> mTabViews;
@@ -75,6 +81,9 @@ public class NavScreen extends RelativeLayout
mUiController = ctl;
mUi = ui;
mOrientation = activity.getResources().getConfiguration().orientation;
+ WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
+ mSize = new Point();
+ wm.getDefaultDisplay().getSize(mSize);
init();
}
@@ -118,9 +127,13 @@ public class NavScreen extends RelativeLayout
setContentDescription(mContext.getResources().getString(
R.string.accessibility_transition_navscreen));
mBookmarks = (ImageButton) findViewById(R.id.bookmarks);
+ mHomeTab = (ImageButton) findViewById(R.id.gotohome);
+ mNewIncognitoTab = (ImageButton) findViewById(R.id.newincognitotab);
mNewTab = (ImageButton) findViewById(R.id.newtab);
mMore = (ImageButton) findViewById(R.id.more);
mBookmarks.setOnClickListener(this);
+ mHomeTab.setOnClickListener(this);
+ mNewIncognitoTab.setOnClickListener(this);
mNewTab.setOnClickListener(this);
mMore.setOnClickListener(this);
mScroller = (NavTabScroller) findViewById(R.id.scroller);
@@ -148,8 +161,10 @@ public class NavScreen extends RelativeLayout
public void onClick(View v) {
if (mBookmarks == v) {
mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
- } else if (mNewTab == v) {
- openNewTab();
+ } else if (mNewIncognitoTab == v || mNewTab == v) {
+ openNewTab(mNewIncognitoTab == v);
+ } else if (mHomeTab == v) {
+ gotoHomePage();
} else if (mMore == v) {
showMenu();
}
@@ -165,10 +180,12 @@ public class NavScreen extends RelativeLayout
}
}
- private void openNewTab() {
+ private void openNewTab(boolean incognito) {
// need to call openTab explicitely with setactive false
- final Tab tab = mUiController.openTab(BrowserSettings.getInstance().getHomePage(),
- false, false, false);
+ final Tab tab = incognito ?
+ mUiController.openIncognitoTab() :
+ mUiController.openTab(BrowserSettings.getInstance().getHomePage(),
+ false, false, false);
if (tab != null) {
mUiController.setBlockEvents(true);
final int tix = mUi.mTabControl.getTabPosition(tab);
@@ -185,6 +202,43 @@ public class NavScreen extends RelativeLayout
}
}
+ private void gotoHomePage() {
+ final Tab tab = findCenteredTab();
+ if (tab != null) {
+ mUiController.setBlockEvents(true);
+ final int tix = mUi.mTabControl.getTabPosition(tab);
+ mScroller.setOnLayoutListener(new OnLayoutListener() {
+ @Override
+ public void onLayout(int l, int t, int r, int b) {
+ mUi.hideNavScreen(tix, true);
+ switchToTab(tab);
+ }
+ });
+ mScroller.handleDataChanged(tix);
+ mUiController.setBlockEvents(false);
+ mUiController.loadUrl(tab,
+ BrowserSettings.getInstance().getHomePage());
+ }
+ }
+
+ private Tab findCenteredTab(){
+ View v = mOrientation == Configuration.ORIENTATION_LANDSCAPE ?
+ mScroller.findViewAt(mSize.y/2, mSize.x/2):
+ mScroller.findViewAt(mSize.x/2, mSize.y/2);
+ if( v != null && v instanceof NavTabView ){
+ Long tabId = ((NavTabView)v).getWebViewId();
+ if( tabId != null ){
+ List<Tab> tabs = mUiController.getTabs();
+ for( int i=0; i<tabs.size(); i++ ){
+ if( tabs.get(i).getId() == tabId.longValue() ) {
+ return tabs.get(i);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
private void switchToTab(Tab tab) {
if (tab != mUi.getActiveTab()) {
mUiController.setActiveTab(tab);
diff --git a/src/com/android/browser/NavTabView.java b/src/com/android/browser/NavTabView.java
index b15e828..72050b2 100644
--- a/src/com/android/browser/NavTabView.java
+++ b/src/com/android/browser/NavTabView.java
@@ -107,6 +107,11 @@ public class NavTabView extends LinearLayout {
return mHighlighted;
}
+ protected Long getWebViewId(){
+ if(mTab == null) return null;
+ return new Long(mTab.getId());
+ }
+
protected void setWebView(Tab tab) {
mTab = tab;
setTitle();
diff --git a/src/com/android/browser/NetworkStateHandler.java b/src/com/android/browser/NetworkStateHandler.java
index 4480664..f3c46aa 100644
--- a/src/com/android/browser/NetworkStateHandler.java
+++ b/src/com/android/browser/NetworkStateHandler.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,6 +113,23 @@ public class NetworkStateHandler {
return mIsNetworkUp;
}
+ boolean isWifiUp() {
+ ConnectivityManager cm = (ConnectivityManager) mActivity
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo info = cm.getActiveNetworkInfo();
+ if (info != null) {
+ switch (info.getType()) {
+ case ConnectivityManager.TYPE_WIFI:
+ case ConnectivityManager.TYPE_ETHERNET:
+ case ConnectivityManager.TYPE_BLUETOOTH:
+ return true;
+ default:
+ return false;
+ }
+ } else
+ return false;
+ }
+
private void sendNetworkType(String type, String subtype) {
WebView w = mController.getCurrentWebView();
if (w != null) {
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 89eae70..a405522 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -191,6 +191,10 @@ public class PhoneUi extends BaseUi {
if (incognito != null) {
incognito.setVisible(showingNavScreen() || mUseQuickControls);
}
+ MenuItem fullscreen = menu.findItem(R.id.fullscreen_menu_id);
+ if (fullscreen != null) {
+ fullscreen.setVisible(!showingNavScreen());
+ }
MenuItem closeOthers = menu.findItem(R.id.close_other_tabs_id);
if (closeOthers != null) {
boolean isLastTab = true;
diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java
index 1828032..594bd81 100644
--- a/src/com/android/browser/PreferenceKeys.java
+++ b/src/com/android/browser/PreferenceKeys.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (c) 2011, 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,6 +84,7 @@ public interface PreferenceKeys {
// ----------------------
static final String PREF_ENABLE_QUICK_CONTROLS = "enable_quick_controls";
static final String PREF_FULLSCREEN = "fullscreen";
+ static final String PREF_ENABLE_WEBGL = "enable_webgl";
// ----------------------
// Keys for privacy_security_preferences.xml
@@ -104,6 +106,7 @@ public interface PreferenceKeys {
// ----------------------
static final String PREF_DATA_PRELOAD = "preload_when";
static final String PREF_LINK_PREFETCH = "link_prefetch_when";
+ static final String PREF_VIDEO_PRELOAD = "preload_video";
static final String PREF_LOAD_IMAGES = "load_images";
// ----------------------
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 683e473..494a04f 100644
--- a/src/com/android/browser/UiController.java
+++ b/src/com/android/browser/UiController.java
@@ -107,6 +107,8 @@ public interface UiController {
void toggleUserAgent();
+ void toggleFullscreen();
+
BrowserSettings getSettings();
boolean supportsVoice();
diff --git a/src/com/android/browser/preferences/BandwidthPreferencesFragment.java b/src/com/android/browser/preferences/BandwidthPreferencesFragment.java
index 0cb064a..36d1689 100644
--- a/src/com/android/browser/preferences/BandwidthPreferencesFragment.java
+++ b/src/com/android/browser/preferences/BandwidthPreferencesFragment.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,6 +59,15 @@ public class BandwidthPreferencesFragment extends PreferenceFragment {
prefetch.setValue(BrowserSettings.getInstance().getDefaultLinkPrefetchSetting());
}
}
+ if (!getPreferenceScreen().getSharedPreferences()
+ .contains(PreferenceKeys.PREF_VIDEO_PRELOAD)) {
+ // set default value for preload setting
+ ListPreference preload = (ListPreference) getPreferenceScreen().findPreference(
+ PreferenceKeys.PREF_VIDEO_PRELOAD);
+ if (preload != null) {
+ preload.setValue(BrowserSettings.getInstance().getDefaultVideoPreloadSetting());
+ }
+ }
}
}
diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java
index 222b5fa..8d33c95 100644
--- a/src/com/android/browser/preferences/LabPreferencesFragment.java
+++ b/src/com/android/browser/preferences/LabPreferencesFragment.java
@@ -17,8 +17,10 @@
package com.android.browser.preferences;
import android.os.Bundle;
+import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
+import android.preference.PreferenceScreen;
import com.android.browser.BrowserSettings;
import com.android.browser.PreferenceKeys;
@@ -32,5 +34,12 @@ public class LabPreferencesFragment extends PreferenceFragment {
super.onCreate(savedInstanceState);
// Load the XML preferences file
addPreferencesFromResource(R.xml.lab_preferences);
+
+ if (!BrowserSettings.isWebGLAvailable()) {
+ CheckBoxPreference webGL = (CheckBoxPreference)
+ findPreference(PreferenceKeys.PREF_ENABLE_WEBGL);
+ PreferenceScreen screen = getPreferenceScreen();
+ screen.removePreference(webGL);
+ }
}
}