Bug 1058909 - Part 1: Don't hide the tabs tray button when opening the tabs tray on new tablet. r=lucasr
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 17 Sep 2014 14:00:04 -0700
changeset 205849 829f8ab0bc4fce434fb2b39958ed3b6598c6fdae
parent 205848 d4df7fb9b8553ea0306f900ef1da68e0697a6e3c
child 205850 eba49b6a540a19a531e8de5669a9f7ef6a94f873
push id8806
push usermichael.l.comella@gmail.com
push dateWed, 17 Sep 2014 20:58:32 +0000
treeherderfx-team@829f8ab0bc4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs1058909
milestone35.0a1
Bug 1058909 - Part 1: Don't hide the tabs tray button when opening the tabs tray on new tablet. r=lucasr
mobile/android/base/toolbar/BrowserToolbarNewTablet.java
mobile/android/base/toolbar/BrowserToolbarTablet.java
mobile/android/base/toolbar/BrowserToolbarTabletBase.java
--- a/mobile/android/base/toolbar/BrowserToolbarNewTablet.java
+++ b/mobile/android/base/toolbar/BrowserToolbarNewTablet.java
@@ -133,9 +133,14 @@ class BrowserToolbarNewTablet extends Br
                       width);
             anim.attach(forwardButton,
                       PropertyAnimator.Property.ALPHA,
                       1);
         }
 
         urlDisplayLayout.prepareForwardAnimation(anim, animation, width);
     }
+
+    @Override
+    public void triggerTabsPanelTransition(final PropertyAnimator animator, final boolean areTabsShown) {
+        // Do nothing.
+    }
 }
--- a/mobile/android/base/toolbar/BrowserToolbarTablet.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTablet.java
@@ -14,16 +14,18 @@ import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.animation.PropertyAnimator;
 import org.mozilla.gecko.animation.ViewHelper;
 
 import android.content.Context;
 import android.content.res.Resources;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Interpolator;
 import android.widget.RelativeLayout;
 
 /**
  * A toolbar implementation for tablets.
  */
 class BrowserToolbarTablet extends BrowserToolbarTabletBase {
 
     private static final int FORWARD_ANIMATION_DURATION = 450;
@@ -32,16 +34,18 @@ class BrowserToolbarTablet extends Brows
     private final RelativeLayout.LayoutParams urlBarEntryShrunkenLayoutParams;
 
     private List<View> tabletDisplayModeViews;
     private boolean hidForwardButtonOnStartEditing;
 
     private final int urlBarViewOffset;
     private final int defaultForwardMargin;
 
+    private final Interpolator buttonsInterpolator = new AccelerateInterpolator();
+
     public BrowserToolbarTablet(final Context context, final AttributeSet attrs) {
         super(context, attrs);
 
         urlBarEntryDefaultLayoutParams = (RelativeLayout.LayoutParams) urlBarEntry.getLayoutParams();
         // API level 19 adds a RelativeLayout.LayoutParams copy constructor, so we explicitly cast
         // to ViewGroup.MarginLayoutParams to ensure consistency across platforms.
         urlBarEntryShrunkenLayoutParams =
                 new RelativeLayout.LayoutParams((ViewGroup.MarginLayoutParams) urlBarEntryDefaultLayoutParams);
@@ -252,9 +256,26 @@ class BrowserToolbarTablet extends Brows
                       width);
             anim.attach(forwardButton,
                       PropertyAnimator.Property.ALPHA,
                       1);
         }
 
         urlDisplayLayout.prepareForwardAnimation(anim, animation, width);
     }
+
+    @Override
+    public void triggerTabsPanelTransition(final PropertyAnimator animator, final boolean areTabsShown) {
+        if (areTabsShown) {
+            ViewHelper.setAlpha(tabsCounter, 0.0f);
+            return;
+        }
+
+        final PropertyAnimator buttonsAnimator =
+                new PropertyAnimator(animator.getDuration(), buttonsInterpolator);
+
+        buttonsAnimator.attach(tabsCounter,
+                               PropertyAnimator.Property.ALPHA,
+                               1.0f);
+
+        buttonsAnimator.start();
+    }
 }
--- a/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
@@ -5,25 +5,21 @@
 
 package org.mozilla.gecko.toolbar;
 
 import java.util.Arrays;
 
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.animation.PropertyAnimator;
-import org.mozilla.gecko.animation.ViewHelper;
 
 import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.View;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.Interpolator;
 import android.widget.Button;
 import android.widget.ImageButton;
 import android.widget.LinearLayout;
 
 /**
  * A base implementations of the browser toolbar for tablets.
  * This class manages any Views, variables, etc. that are exclusive to tablet.
  */
@@ -34,18 +30,16 @@ abstract class BrowserToolbarTabletBase 
         HIDE
     }
 
     protected final LinearLayout actionItemBar;
 
     protected final BackButton backButton;
     protected final ForwardButton forwardButton;
 
-    private final Interpolator buttonsInterpolator = new AccelerateInterpolator();
-
     protected abstract void animateForwardButton(ForwardButtonAnimation animation);
 
     public BrowserToolbarTabletBase(final Context context, final AttributeSet attrs) {
         super(context, attrs);
 
         actionItemBar = (LinearLayout) findViewById(R.id.menu_items);
 
         backButton = (BackButton) findViewById(R.id.back);
@@ -126,33 +120,16 @@ abstract class BrowserToolbarTabletBase 
 
     @Override
     public void setPrivateMode(final boolean isPrivate) {
         super.setPrivateMode(isPrivate);
         backButton.setPrivateMode(isPrivate);
         forwardButton.setPrivateMode(isPrivate);
     }
 
-    @Override
-    public void triggerTabsPanelTransition(final PropertyAnimator animator, final boolean areTabsShown) {
-        if (areTabsShown) {
-            ViewHelper.setAlpha(tabsCounter, 0.0f);
-            return;
-        }
-
-        final PropertyAnimator buttonsAnimator =
-                new PropertyAnimator(animator.getDuration(), buttonsInterpolator);
-
-        buttonsAnimator.attach(tabsCounter,
-                               PropertyAnimator.Property.ALPHA,
-                               1.0f);
-
-        buttonsAnimator.start();
-    }
-
     protected boolean canDoBack(final Tab tab) {
         return (tab.canDoBack() && !isEditing());
     }
 
     protected boolean canDoForward(final Tab tab) {
         return (tab.canDoForward() && !isEditing());
     }