From aae029c3166b0f6e0179a5973c885aea118fb31b Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 16 Sep 2011 14:36:39 -0700 Subject: Use overlay action mode Bug: 5327408 By using actionBar: false with actionModeOverlay: true the action mode callbacks happen before the action mode animation. This allows us to animate down the URL bar at the same time if needed (when the URL is being edited). Overlay mode fixes the issue with webview being translated, which was what caused the selection handles to move. Only the selection handles were affected thanks to b/4982054 Change-Id: I8153de63124eb4e4d02e88637f0cf01658054a14 --- src/com/android/browser/PhoneUi.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/com/android/browser/PhoneUi.java') diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java index 606a47d..61acef5 100644 --- a/src/com/android/browser/PhoneUi.java +++ b/src/com/android/browser/PhoneUi.java @@ -26,6 +26,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; import android.util.Log; +import android.util.TypedValue; import android.view.ActionMode; import android.view.Gravity; import android.view.KeyEvent; @@ -52,6 +53,7 @@ public class PhoneUi extends BaseUi { private PieControlPhone mPieControl; private NavScreen mNavScreen; private NavigationBarPhone mNavigationBar; + private int mActionBarHeight; boolean mExtendedMenuOpen; boolean mOptionsMenuOpen; @@ -63,9 +65,13 @@ public class PhoneUi extends BaseUi { */ public PhoneUi(Activity browser, UiController controller) { super(browser, controller); - mActivity.getActionBar().hide(); setUseQuickControls(BrowserSettings.getInstance().useQuickControls()); mNavigationBar = (NavigationBarPhone) mTitleBar.getNavigationBar(); + TypedValue heightValue = new TypedValue(); + browser.getTheme().resolveAttribute( + com.android.internal.R.attr.actionBarSize, heightValue, true); + mActionBarHeight = TypedValue.complexToDimensionPixelSize(heightValue.data, + browser.getResources().getDisplayMetrics()); } @Override @@ -208,18 +214,20 @@ public class PhoneUi extends BaseUi { public void onActionModeStarted(ActionMode mode) { if (!isEditingUrl()) { hideTitleBar(); + } else { + mTitleBar.animate().translationY(mActionBarHeight); } } @Override public void onActionModeFinished(boolean inLoad) { + mTitleBar.animate().translationY(0); if (inLoad) { if (mUseQuickControls) { mTitleBar.setShowProgressOnly(true); } showTitleBar(); } - mActivity.getActionBar().hide(); } @Override -- cgit v1.1