am 092cfaaa: Merge "cherry-picked bf4650ca39 to froyo" into froyo
Merge commit '092cfaaa22795b7e63f2e55ff9102a569ec17efe' into kraken
* commit '092cfaaa22795b7e63f2e55ff9102a569ec17efe':
cherry-picked bf4650ca39 to froyo
This commit is contained in:
@@ -763,6 +763,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
private ExtendedZoomControls mZoomControls;
|
private ExtendedZoomControls mZoomControls;
|
||||||
private Runnable mZoomControlRunnable;
|
private Runnable mZoomControlRunnable;
|
||||||
|
|
||||||
|
// mZoomButtonsController will be lazy initialized in
|
||||||
|
// getZoomButtonsController() to get better performance.
|
||||||
private ZoomButtonsController mZoomButtonsController;
|
private ZoomButtonsController mZoomButtonsController;
|
||||||
|
|
||||||
// These keep track of the center point of the zoom. They are used to
|
// These keep track of the center point of the zoom. They are used to
|
||||||
@@ -844,18 +846,6 @@ public class WebView extends AbsoluteLayout
|
|||||||
mDatabase = WebViewDatabase.getInstance(context);
|
mDatabase = WebViewDatabase.getInstance(context);
|
||||||
mScroller = new OverScroller(context);
|
mScroller = new OverScroller(context);
|
||||||
|
|
||||||
mZoomButtonsController = new ZoomButtonsController(this);
|
|
||||||
mZoomButtonsController.setOnZoomListener(mZoomListener);
|
|
||||||
// ZoomButtonsController positions the buttons at the bottom, but in
|
|
||||||
// the middle. Change their layout parameters so they appear on the
|
|
||||||
// right.
|
|
||||||
View controls = mZoomButtonsController.getZoomControls();
|
|
||||||
ViewGroup.LayoutParams params = controls.getLayoutParams();
|
|
||||||
if (params instanceof FrameLayout.LayoutParams) {
|
|
||||||
FrameLayout.LayoutParams frameParams = (FrameLayout.LayoutParams)
|
|
||||||
params;
|
|
||||||
frameParams.gravity = Gravity.RIGHT;
|
|
||||||
}
|
|
||||||
updateMultiTouchSupport(context);
|
updateMultiTouchSupport(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,15 +865,16 @@ public class WebView extends AbsoluteLayout
|
|||||||
private void updateZoomButtonsEnabled() {
|
private void updateZoomButtonsEnabled() {
|
||||||
boolean canZoomIn = mActualScale < mMaxZoomScale;
|
boolean canZoomIn = mActualScale < mMaxZoomScale;
|
||||||
boolean canZoomOut = mActualScale > mMinZoomScale && !mInZoomOverview;
|
boolean canZoomOut = mActualScale > mMinZoomScale && !mInZoomOverview;
|
||||||
|
ZoomButtonsController controller = getZoomButtonsController();
|
||||||
if (!canZoomIn && !canZoomOut) {
|
if (!canZoomIn && !canZoomOut) {
|
||||||
// Hide the zoom in and out buttons, as well as the fit to page
|
// Hide the zoom in and out buttons, as well as the fit to page
|
||||||
// button, if the page cannot zoom
|
// button, if the page cannot zoom
|
||||||
mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
|
controller.getZoomControls().setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
// Set each one individually, as a page may be able to zoom in
|
// Set each one individually, as a page may be able to zoom in
|
||||||
// or out.
|
// or out.
|
||||||
mZoomButtonsController.setZoomInEnabled(canZoomIn);
|
controller.setZoomInEnabled(canZoomIn);
|
||||||
mZoomButtonsController.setZoomOutEnabled(canZoomOut);
|
controller.setZoomOutEnabled(canZoomOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1760,7 +1751,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
}
|
}
|
||||||
clearTextEntry(false);
|
clearTextEntry(false);
|
||||||
if (getSettings().getBuiltInZoomControls()) {
|
if (getSettings().getBuiltInZoomControls()) {
|
||||||
mZoomButtonsController.setVisible(true);
|
getZoomButtonsController().setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
mPrivateHandler.removeCallbacks(mZoomControlRunnable);
|
mPrivateHandler.removeCallbacks(mZoomControlRunnable);
|
||||||
mPrivateHandler.postDelayed(mZoomControlRunnable,
|
mPrivateHandler.postDelayed(mZoomControlRunnable,
|
||||||
@@ -4072,7 +4063,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
// false for the first parameter
|
// false for the first parameter
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getSettings().getBuiltInZoomControls() && !mZoomButtonsController.isVisible()) {
|
if (getSettings().getBuiltInZoomControls() && !getZoomButtonsController().isVisible()) {
|
||||||
/*
|
/*
|
||||||
* The zoom controls come in their own window, so our window
|
* The zoom controls come in their own window, so our window
|
||||||
* loses focus. Our policy is to not draw the cursor ring if
|
* loses focus. Our policy is to not draw the cursor ring if
|
||||||
@@ -5050,7 +5041,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
WebSettings settings = getSettings();
|
WebSettings settings = getSettings();
|
||||||
if (settings.supportZoom()
|
if (settings.supportZoom()
|
||||||
&& settings.getBuiltInZoomControls()
|
&& settings.getBuiltInZoomControls()
|
||||||
&& !mZoomButtonsController.isVisible()
|
&& !getZoomButtonsController().isVisible()
|
||||||
&& mMinZoomScale < mMaxZoomScale) {
|
&& mMinZoomScale < mMaxZoomScale) {
|
||||||
mZoomButtonsController.setVisible(true);
|
mZoomButtonsController.setVisible(true);
|
||||||
int count = settings.getDoubleTapToastCount();
|
int count = settings.getDoubleTapToastCount();
|
||||||
@@ -5593,6 +5584,19 @@ public class WebView extends AbsoluteLayout
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public ZoomButtonsController getZoomButtonsController() {
|
public ZoomButtonsController getZoomButtonsController() {
|
||||||
|
if (mZoomButtonsController == null) {
|
||||||
|
mZoomButtonsController = new ZoomButtonsController(this);
|
||||||
|
mZoomButtonsController.setOnZoomListener(mZoomListener);
|
||||||
|
// ZoomButtonsController positions the buttons at the bottom, but in
|
||||||
|
// the middle. Change their layout parameters so they appear on the
|
||||||
|
// right.
|
||||||
|
View controls = mZoomButtonsController.getZoomControls();
|
||||||
|
ViewGroup.LayoutParams params = controls.getLayoutParams();
|
||||||
|
if (params instanceof FrameLayout.LayoutParams) {
|
||||||
|
FrameLayout.LayoutParams frameParams = (FrameLayout.LayoutParams) params;
|
||||||
|
frameParams.gravity = Gravity.RIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
return mZoomButtonsController;
|
return mZoomButtonsController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5832,7 +5836,9 @@ public class WebView extends AbsoluteLayout
|
|||||||
if (mWebViewCore == null) {
|
if (mWebViewCore == null) {
|
||||||
// maybe called after WebView's destroy(). As we can't get settings,
|
// maybe called after WebView's destroy(). As we can't get settings,
|
||||||
// just hide zoom control for both styles.
|
// just hide zoom control for both styles.
|
||||||
mZoomButtonsController.setVisible(false);
|
if (mZoomButtonsController != null) {
|
||||||
|
mZoomButtonsController.setVisible(false);
|
||||||
|
}
|
||||||
if (mZoomControls != null) {
|
if (mZoomControls != null) {
|
||||||
mZoomControls.hide();
|
mZoomControls.hide();
|
||||||
}
|
}
|
||||||
@@ -5840,7 +5846,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
}
|
}
|
||||||
WebSettings settings = getSettings();
|
WebSettings settings = getSettings();
|
||||||
if (settings.getBuiltInZoomControls()) {
|
if (settings.getBuiltInZoomControls()) {
|
||||||
if (mZoomButtonsController.isVisible()) {
|
if (getZoomButtonsController().isVisible()) {
|
||||||
mZoomButtonsController.setVisible(false);
|
mZoomButtonsController.setVisible(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user