Merge "Enable dev mode"
diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml
index 99ac04d..34728d8 100644
--- a/res/layout/title_bar.xml
+++ b/res/layout/title_bar.xml
@@ -21,6 +21,7 @@
android:orientation="vertical" >
<LinearLayout
+ android:id="@+id/taburlbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
diff --git a/res/raw/most_visited.ktpl b/res/raw/most_visited.ktpl
index 04b9eee..9a6e1b8 100644
--- a/res/raw/most_visited.ktpl
+++ b/res/raw/most_visited.ktpl
@@ -3,7 +3,7 @@
<html>
<head>
<title><%@ string/new_tab %></title>
-<meta name="viewport" content="width=device-width; initial-scale=1.0;" />
+<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0" />
<style type="text/css">
@@ -14,20 +14,19 @@
body {
text-align: center;
- margin: 16px auto;
+ margin: 0px auto;
padding: 0 8px 0 8px;
max-width: <%@ dimen/mv_max_width %>px;
}
-#most_visited h3 {
+h3 {
text-align: center;
- padding: 0;
- margin: 5px 0 5px 0px;
+ margin: 5px 0 5px 0;
}
.thumbwrap li {
display: inline-block;
- margin: 0 7px 15px 7px;
+ margin: 0 7px 12px 7px;
padding: 0;
}
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index dd76eb9..b695120 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -40,11 +40,11 @@
<dimen name="qc_item_size">48dip</dimen>
<dimen name="bookmark_widget_thumb_size">32dip</dimen>
<dimen name="bookmark_widget_favicon_size">26dip</dimen>
- <!-- For the most visited page -->
- <dimen name="mv_max_width">830dp</dimen>
- <dimen name="mv_item_width">96dp</dimen>
- <dimen name="mv_item_width_portrait">96dp</dimen>
- <dimen name="mv_border_width">3dp</dimen>
+ <!-- For the most visited page (we use px as these are adjusted by the browser) -->
+ <dimen name="mv_max_width">830px</dimen>
+ <dimen name="mv_item_width">94px</dimen>
+ <dimen name="mv_item_width_portrait">80px</dimen>
+ <dimen name="mv_border_width">2px</dimen>
<dimen name="tab_padding_top">12dp</dimen>
<dimen name="tab_first_padding_left">12dp</dimen>
<dimen name="list_favicon_padding">5dip</dimen>
diff --git a/res/xml-xlarge/lab_preferences.xml b/res/xml-xlarge/lab_preferences.xml
new file mode 100644
index 0000000..87383b0
--- /dev/null
+++ b/res/xml-xlarge/lab_preferences.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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" >
+
+ <CheckBoxPreference
+ android:key="enable_quick_controls"
+ android:defaultValue="false"
+ android:title="@string/pref_lab_quick_controls"
+ android:summary="@string/pref_lab_quick_controls_summary" />
+
+ <CheckBoxPreference
+ android:key="use_most_visited_homepage"
+ android:defaultValue="false"
+ android:title="@string/pref_lab_most_visited_homepage"
+ android:summary="@string/pref_lab_most_visited_homepage_summary" />
+
+ <CheckBoxPreference
+ android:key="use_instant_search"
+ android:defaultValue="false"
+ android:title="@string/pref_use_instant_search"
+ android:summary="@string/pref_use_instant_search_summary" />
+</PreferenceScreen>
diff --git a/res/xml/lab_preferences.xml b/res/xml/lab_preferences.xml
index 87383b0..3a384f1 100644
--- a/res/xml/lab_preferences.xml
+++ b/res/xml/lab_preferences.xml
@@ -16,22 +16,9 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <CheckBoxPreference
- android:key="enable_quick_controls"
- android:defaultValue="false"
- android:title="@string/pref_lab_quick_controls"
- android:summary="@string/pref_lab_quick_controls_summary" />
-
<CheckBoxPreference
android:key="use_most_visited_homepage"
android:defaultValue="false"
android:title="@string/pref_lab_most_visited_homepage"
android:summary="@string/pref_lab_most_visited_homepage_summary" />
-
- <CheckBoxPreference
- android:key="use_instant_search"
- android:defaultValue="false"
- android:title="@string/pref_use_instant_search"
- android:summary="@string/pref_use_instant_search_summary" />
</PreferenceScreen>
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 71346ae..51775d2 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -23,6 +23,7 @@
import android.animation.Animator.AnimatorListener;
import android.animation.ObjectAnimator;
import android.app.Activity;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -122,6 +123,20 @@
mTitleShowing = false;
}
+ @Override
+ public WebView createWebView(boolean privateBrowsing) {
+ // Create a new WebView
+ BrowserWebView w = new BrowserWebView(mActivity, null,
+ android.R.attr.webViewStyle, privateBrowsing);
+ initWebViewSettings(w);
+ return w;
+ }
+
+ @Override
+ public WebView createSubWebView(boolean privateBrowsing) {
+ return createWebView(privateBrowsing);
+ }
+
/**
* common webview initialization
* @param w the webview to initialize
@@ -132,6 +147,10 @@
w.setMapTrackballToArrowKeys(false); // use trackball directly
// Enable the built-in zoom
w.getSettings().setBuiltInZoomControls(true);
+ boolean supportsMultiTouch = mActivity.getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
+ w.getSettings().setDisplayZoomControls(!supportsMultiTouch);
+ w.setExpandedTileBounds(true); // smoother scrolling
// Add this WebView to the settings observer list and update the
// settings
diff --git a/src/com/android/browser/ScrollWebView.java b/src/com/android/browser/BrowserWebView.java
similarity index 92%
rename from src/com/android/browser/ScrollWebView.java
rename to src/com/android/browser/BrowserWebView.java
index 8c89e51..6111aa6 100644
--- a/src/com/android/browser/ScrollWebView.java
+++ b/src/com/android/browser/BrowserWebView.java
@@ -17,7 +17,6 @@
package com.android.browser;
import android.content.Context;
-import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -28,14 +27,13 @@
/**
* Manage WebView scroll events
*/
-public class ScrollWebView extends WebView implements Runnable {
+public class BrowserWebView extends WebView implements Runnable {
private ScrollListener mScrollListener;
private boolean mIsCancelled;
private boolean mBackgroundRemoved = false;
private boolean mUserInitiated = false;
private TitleBarBase mTitleBar;
- private Bitmap mBitmap;
/**
* @param context
@@ -43,7 +41,7 @@
* @param defStyle
* @param javascriptInterfaces
*/
- public ScrollWebView(Context context, AttributeSet attrs, int defStyle,
+ public BrowserWebView(Context context, AttributeSet attrs, int defStyle,
Map<String, Object> javascriptInterfaces, boolean privateBrowsing) {
super(context, attrs, defStyle, javascriptInterfaces, privateBrowsing);
}
@@ -53,7 +51,7 @@
* @param attrs
* @param defStyle
*/
- public ScrollWebView(
+ public BrowserWebView(
Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {
super(context, attrs, defStyle, privateBrowsing);
}
@@ -62,14 +60,14 @@
* @param context
* @param attrs
*/
- public ScrollWebView(Context context, AttributeSet attrs) {
+ public BrowserWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* @param context
*/
- public ScrollWebView(Context context) {
+ public BrowserWebView(Context context) {
super(context);
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index f1939e4..290ddf6 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -62,23 +62,6 @@
mActivity.getActionBar().hide();
}
- // webview factory
-
- @Override
- public WebView createWebView(boolean privateBrowsing) {
- // Create a new WebView
- WebView w = new WebView(mActivity, null,
- android.R.attr.webViewStyle, privateBrowsing);
- initWebViewSettings(w);
- return w;
- }
-
- @Override
- public WebView createSubWebView(boolean privateBrowsing) {
- WebView web = createWebView(privateBrowsing);
- return web;
- }
-
// lifecycle
@Override
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 1d17cb3..c97fc71 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -16,7 +16,7 @@
package com.android.browser;
-import com.android.browser.ScrollWebView.ScrollListener;
+import com.android.browser.BrowserWebView.ScrollListener;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index 686416c..f1fcdc3 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -52,6 +52,7 @@
private boolean mInLoad;
private Intent mVoiceSearchIntent;
private ImageSpan mArcsSpan;
+ private View mContainer;
public TitleBar(Activity activity, UiController controller, PhoneUi ui) {
super(activity, controller, ui);
@@ -59,6 +60,7 @@
factory.inflate(R.layout.title_bar, this);
mActivity = activity;
+ mContainer = findViewById(R.id.taburlbar);
mUrlInput = (UrlInputView) findViewById(R.id.url_input);
mUrlInput.setCompoundDrawablePadding(5);
mUrlInput.setContainer(this);
@@ -101,6 +103,12 @@
}
@Override
+ public int getEmbeddedHeight() {
+ int height = mContainer.getHeight();
+ return height;
+ }
+
+ @Override
public void createContextMenu(ContextMenu menu) {
MenuInflater inflater = mActivity.getMenuInflater();
inflater.inflate(R.menu.title_context, menu);
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 13018af..92fdc97 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -16,7 +16,7 @@
package com.android.browser;
-import com.android.browser.ScrollWebView.ScrollListener;
+import com.android.browser.BrowserWebView.ScrollListener;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
@@ -149,23 +149,14 @@
@Override
public WebView createWebView(boolean privateBrowsing) {
// Create a new WebView
- ScrollWebView w = new ScrollWebView(mActivity, null,
- android.R.attr.webViewStyle, privateBrowsing);
- initWebViewSettings(w);
+ BrowserWebView w = (BrowserWebView) super.createWebView(privateBrowsing);
w.setScrollListener(this);
- boolean supportsMultiTouch = mActivity.getPackageManager()
- .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
- w.getSettings().setDisplayZoomControls(!supportsMultiTouch);
- w.setExpandedTileBounds(true); // smoother scrolling
return w;
}
@Override
public WebView createSubWebView(boolean privateBrowsing) {
- ScrollWebView web = (ScrollWebView) createWebView(privateBrowsing);
- // no scroll listener for subview
- web.setScrollListener(null);
- return web;
+ return super.createWebView(privateBrowsing);
}
@Override
@@ -174,7 +165,7 @@
}
void stopWebViewScrolling() {
- ScrollWebView web = (ScrollWebView) mUiController.getCurrentWebView();
+ BrowserWebView web = (BrowserWebView) mUiController.getCurrentWebView();
if (web != null) {
web.stopScroll();
}
@@ -237,7 +228,7 @@
@Override
void setActiveTab(Tab tab, boolean needsAttaching) {
- ScrollWebView view = (ScrollWebView) tab.getWebView();
+ BrowserWebView view = (BrowserWebView) tab.getWebView();
// TabControl.setCurrentTab has been called before this,
// so the tab is guaranteed to have a webview
if (view == null) {
diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java
index a06dc3e..88a9690 100644
--- a/src/com/android/browser/preferences/LabPreferencesFragment.java
+++ b/src/com/android/browser/preferences/LabPreferencesFragment.java
@@ -42,21 +42,25 @@
addPreferencesFromResource(R.xml.lab_preferences);
Preference e = findPreference(BrowserSettings.PREF_QUICK_CONTROLS);
- e.setOnPreferenceChangeListener(this);
+ if (e != null) {
+ e.setOnPreferenceChangeListener(this);
+ }
useInstantPref = findPreference(BrowserSettings.PREF_USE_INSTANT);
}
@Override
public void onResume() {
super.onResume();
- useInstantPref.setEnabled(false);
+ if (useInstantPref != null) {
+ useInstantPref.setEnabled(false);
- // Enable the "use instant" preference only if the selected
- // search engine is google.
- if (mBrowserSettings.getSearchEngine() != null) {
- final String currentName = mBrowserSettings.getSearchEngine().getName();
- if (SearchEngine.GOOGLE.equals(currentName)) {
- useInstantPref.setEnabled(true);
+ // Enable the "use instant" preference only if the selected
+ // search engine is google.
+ if (mBrowserSettings.getSearchEngine() != null) {
+ final String currentName = mBrowserSettings.getSearchEngine().getName();
+ if (SearchEngine.GOOGLE.equals(currentName)) {
+ useInstantPref.setEnabled(true);
+ }
}
}
}