diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 21644422102d..52afba59b50f 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -258,6 +258,12 @@ public class BrowserApp extends GeckoApp private static final int ADDON_MENU_OFFSET = 1000; public static final String TAB_HISTORY_FRAGMENT_TAG = "tabHistoryFragment"; + // When the static action bar is shown, only the real toolbar chrome should be + // shown when the toolbar is visible. Causing the toolbar animator to also + // show the snapshot causes the content to shift under the users finger. + // See: Bug 1358554 + private boolean mShowingToolbarChromeForActionBar; + private static class MenuItemInfo { public int id; public String label; @@ -386,7 +392,10 @@ public class BrowserApp extends GeckoApp updateHomePagerForTab(tab); } - mDynamicToolbar.persistTemporaryVisibility(); + if (mShowingToolbarChromeForActionBar) { + mDynamicToolbar.setVisible(true, VisibilityTransition.IMMEDIATE); + mShowingToolbarChromeForActionBar = false; + } break; case START: if (Tabs.getInstance().isSelectedTab(tab)) { @@ -4036,6 +4045,7 @@ public class BrowserApp extends GeckoApp return this; } + /* Implementing ActionModeCompat.Presenter */ @Override public void startActionMode(final ActionModeCompat.Callback callback) { @@ -4044,9 +4054,11 @@ public class BrowserApp extends GeckoApp mActionBarFlipper.showNext(); DynamicToolbarAnimator toolbar = mLayerView.getDynamicToolbarAnimator(); - // If the toolbar is dynamic and not currently showing, just slide it in + // If the toolbar is dynamic and not currently showing, just show the real toolbar + // and keep the animated snapshot hidden if (mDynamicToolbar.isEnabled() && toolbar.getCurrentToolbarHeight() == 0) { - mDynamicToolbar.setTemporarilyVisible(true, VisibilityTransition.ANIMATE); + toggleToolbarChrome(true); + mShowingToolbarChromeForActionBar = true; } mDynamicToolbar.setPinned(true, PinReason.ACTION_MODE); @@ -4075,9 +4087,12 @@ public class BrowserApp extends GeckoApp mActionBarFlipper.showPrevious(); - // Only slide the urlbar out if it was hidden when the action mode started - // Don't animate hiding it so that there's no flash as we switch back to url mode - mDynamicToolbar.setTemporarilyVisible(false, VisibilityTransition.IMMEDIATE); + // Hide the real toolbar chrome if it was hidden before the action bar + // was shown. + if (mShowingToolbarChromeForActionBar) { + toggleToolbarChrome(false); + mShowingToolbarChromeForActionBar = false; + } } public static interface TabStripInterface { diff --git a/mobile/android/base/java/org/mozilla/gecko/DynamicToolbar.java b/mobile/android/base/java/org/mozilla/gecko/DynamicToolbar.java index 28f542d5c87f..c8570322c8ec 100644 --- a/mobile/android/base/java/org/mozilla/gecko/DynamicToolbar.java +++ b/mobile/android/base/java/org/mozilla/gecko/DynamicToolbar.java @@ -149,36 +149,6 @@ public class DynamicToolbar { } } - public void setTemporarilyVisible(boolean visible, VisibilityTransition transition) { - ThreadUtils.assertOnUiThread(); - - if (layerView == null) { - return; - } - - if (visible == temporarilyVisible) { - // nothing to do - return; - } - - temporarilyVisible = visible; - final boolean isImmediate = transition == VisibilityTransition.IMMEDIATE; - if (visible) { - layerView.getDynamicToolbarAnimator().showToolbar(isImmediate); - } else { - layerView.getDynamicToolbarAnimator().hideToolbar(isImmediate); - } - } - - public void persistTemporaryVisibility() { - ThreadUtils.assertOnUiThread(); - - if (temporarilyVisible) { - temporarilyVisible = false; - setVisible(true, VisibilityTransition.IMMEDIATE); - } - } - public void setPinned(boolean pinned, PinReason reason) { ThreadUtils.assertOnUiThread(); if (layerView == null) {