Bug 1116912 - Don't hide the dynamic toolbar when it was originally shown but a tab was selected. r=wesj, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 16 Jan 2015 17:37:20 -0800
changeset 242945 55bd32c43abd
parent 242944 56744595737c
child 242946 12bda229bf83
push id4343
push userryanvm@gmail.com
push date2015-01-20 16:38 +0000
treeherdermozilla-beta@c5dfa7d081f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, sledru
bugs1116912
milestone36.0
Bug 1116912 - Don't hide the dynamic toolbar when it was originally shown but a tab was selected. r=wesj, a=sledru Additionally, rename mShowActionModeEndAnimation to make it more intuitive and clean up it's initialization.
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -179,17 +179,17 @@ public class BrowserApp extends GeckoApp
     public ActionModeCompatView mActionBar;
     private BrowserToolbar mBrowserToolbar;
     private ToolbarProgressView mProgressView;
     private HomePager mHomePager;
     private TabsPanel mTabsPanel;
     private ViewGroup mHomePagerContainer;
     protected Telemetry.Timer mAboutHomeStartupTimer;
     private ActionModeCompat mActionMode;
-    private boolean mShowActionModeEndAnimation;
+    private boolean mHideDynamicToolbarOnActionModeEnd;
     private TabHistoryController tabHistoryController;
 
     private static final int GECKO_TOOLS_MENU = -1;
     private static final int ADDON_MENU_OFFSET = 1000;
     public static final String TAB_HISTORY_FRAGMENT_TAG = "tabHistoryFragment";
     private static class MenuItemInfo {
         public int id;
         public String label;
@@ -286,16 +286,18 @@ public class BrowserApp extends GeckoApp
         Log.d(LOGTAG, "BrowserApp.onTabChanged: " + tab.getId() + ": " + msg);
         switch(msg) {
             case LOCATION_CHANGE:
                 // fall through
             case SELECTED:
                 if (Tabs.getInstance().isSelectedTab(tab)) {
                     updateHomePagerForTab(tab);
                 }
+
+                mHideDynamicToolbarOnActionModeEnd = false;
                 break;
             case START:
                 if (Tabs.getInstance().isSelectedTab(tab)) {
                     invalidateOptionsMenu();
 
                     if (mDynamicToolbar.isEnabled()) {
                         mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
                     }
@@ -3291,20 +3293,21 @@ public class BrowserApp extends GeckoApp
         if (mActionMode == null) {
             mActionBarFlipper.showNext();
             LayerMarginsAnimator margins = mLayerView.getLayerMarginsAnimator();
 
             // If the toolbar is dynamic and not currently showing, just slide it in
             if (mDynamicToolbar.isEnabled() && !margins.areMarginsShown()) {
                 margins.setMaxMargins(0, mBrowserChrome.getHeight(), 0, 0);
                 mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
-                mShowActionModeEndAnimation = true;
+                mHideDynamicToolbarOnActionModeEnd = true;
             } else {
                 // Otherwise, we animate the actionbar itself
                 mActionBar.animateIn();
+                mHideDynamicToolbarOnActionModeEnd = false;
             }
 
             mDynamicToolbar.setPinned(true, PinReason.ACTION_MODE);
         } else {
             // Otherwise, we're already showing an action mode. Just finish it and show the new one
             mActionMode.finish();
         }
 
@@ -3324,19 +3327,18 @@ public class BrowserApp extends GeckoApp
         mActionMode.finish();
         mActionMode = null;
         mDynamicToolbar.setPinned(false, PinReason.ACTION_MODE);
 
         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
-        if (mShowActionModeEndAnimation) {
+        if (mHideDynamicToolbarOnActionModeEnd) {
             mDynamicToolbar.setVisible(false, VisibilityTransition.IMMEDIATE);
-            mShowActionModeEndAnimation = false;
         }
     }
 
     @Override
     protected HealthRecorder createHealthRecorder(final Context context,
                                                   final String profilePath,
                                                   final EventDispatcher dispatcher,
                                                   final String osLocale,