diff options
-rw-r--r-- | res/layout/title_bar.xml | 1 | ||||
-rw-r--r-- | src/com/android/browser/BaseUi.java | 19 | ||||
-rw-r--r-- | src/com/android/browser/BrowserWebView.java (renamed from src/com/android/browser/ScrollWebView.java) | 12 | ||||
-rw-r--r-- | src/com/android/browser/PhoneUi.java | 17 | ||||
-rw-r--r-- | src/com/android/browser/TabBar.java | 2 | ||||
-rw-r--r-- | src/com/android/browser/TitleBar.java | 8 | ||||
-rw-r--r-- | src/com/android/browser/XLargeUi.java | 19 |
7 files changed, 39 insertions, 39 deletions
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/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; 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 @@ public abstract class BaseUi implements UI, WebViewFactory { 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 @@ public abstract class BaseUi implements UI, WebViewFactory { 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 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 @@ import java.util.Map; /** * 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 @@ public class ScrollWebView extends WebView implements Runnable { * @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 @@ public class ScrollWebView extends WebView implements Runnable { * @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 @@ public class ScrollWebView extends WebView implements Runnable { * @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 @@ public class PhoneUi extends BaseUi { 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 @@ public class TitleBar extends TitleBarBase implements OnFocusChangeListener, 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 @@ public class TitleBar extends TitleBarBase implements OnFocusChangeListener, 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 @@ public class TitleBar extends TitleBarBase implements OnFocusChangeListener, } @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 @@ public class XLargeUi extends BaseUi implements ScrollListener { @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 @@ public class XLargeUi extends BaseUi implements ScrollListener { } void stopWebViewScrolling() { - ScrollWebView web = (ScrollWebView) mUiController.getCurrentWebView(); + BrowserWebView web = (BrowserWebView) mUiController.getCurrentWebView(); if (web != null) { web.stopScroll(); } @@ -237,7 +228,7 @@ public class XLargeUi extends BaseUi implements ScrollListener { @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) { |