Bug 949613 - Hide the titlebar if it was showing when an action mode started. r=lucasr a=bajaj
authorWes Johnston <wjohnston@mozilla.com>
Mon, 13 Jan 2014 15:20:13 -0800
changeset 169488 d3123e80b8da
parent 169487 aa312b4e40c3
child 169489 f8e37f7c4034
push id5064
push userlrocha@mozilla.com
push date2014-01-24 10:27 +0000
treeherdermozilla-aurora@d3123e80b8da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr, bajaj
bugs949613
milestone28.0a2
Bug 949613 - Hide the titlebar if it was showing when an action mode started. r=lucasr a=bajaj
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -116,16 +116,17 @@ abstract public class BrowserApp extends
 
     public ViewFlipper mViewFlipper;
     public ActionModeCompatView mActionBar;
     private BrowserToolbar mBrowserToolbar;
     private HomePager mHomePager;
     private View mHomePagerContainer;
     protected Telemetry.Timer mAboutHomeStartupTimer = null;
     private ActionModeCompat mActionMode;
+    private boolean mShowActionModeEndAnimation = false;
 
     private static final int GECKO_TOOLS_MENU = -1;
     private static final int ADDON_MENU_OFFSET = 1000;
     private static class MenuItemInfo {
         public int id;
         public String label;
         public String icon;
         public boolean checkable = false;
@@ -2549,16 +2550,17 @@ abstract public class BrowserApp extends
         if (mActionMode == null) {
             mViewFlipper.showNext();
             LayerMarginsAnimator margins = mLayerView.getLayerMarginsAnimator();
 
             // If the toolbar is dynamic and not currently showing, just slide it in
             if (isDynamicToolbarEnabled() && !margins.areMarginsShown()) {
                 margins.setMaxMargins(0, mViewFlipper.getHeight(), 0, 0);
                 margins.showMargins(false);
+                mShowActionModeEndAnimation = true;
             } else {
                 // Otherwise, we animate the actionbar itself
                 mActionBar.animateIn();
             }
 
             margins.setMarginsPinned(true);
         } else {
             // Otherwise, we're already showing an action mode. Just finish it and show the new one
@@ -2575,12 +2577,21 @@ abstract public class BrowserApp extends
     @Override
     public void endActionModeCompat() {
         if (mActionMode == null) {
             return;
         }
 
         mActionMode.finish();
         mActionMode = null;
-        mLayerView.getLayerMarginsAnimator().setMarginsPinned(false);
+        final LayerMarginsAnimator margins = mLayerView.getLayerMarginsAnimator();
+        margins.setMarginsPinned(false);
+
         mViewFlipper.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
+        if (mShowActionModeEndAnimation) {
+            margins.hideMargins(true);
+            mShowActionModeEndAnimation = false;
+        }
     }
 }