Bug 865228 - Slide tabs button all the way off screen (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Wed, 01 May 2013 17:32:01 +0100
changeset 141427 3f18ab3e32f27805cf10faffb80137d0cfeaaf2a
parent 141426 fc1062d6135cadd1c12c0baa56dc4656dbeefd91
child 141428 885e0fb3afca0139d326b683f4c9d589bc006ec9
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs865228
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 865228 - Slide tabs button all the way off screen (r=mfinkle)
mobile/android/base/BrowserToolbar.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -537,20 +537,24 @@ public class BrowserToolbar implements T
 
     @Override
     public void onAnimationEnd(Animation animation) {
         if (animation.equals(mTitleSlideRight)) {
             mSiteSecurity.startAnimation(mLockFadeIn);
         }
     }
 
-    private int getAwesomeBarAnimTranslation() {
+    private int getAwesomeBarEntryTranslation() {
         return mLayout.getWidth() - mAwesomeBarEntry.getRight();
     }
 
+    private int getAwesomeBarCurveTranslation() {
+        return mLayout.getWidth() - mTabs.getLeft();
+    }
+
     public void fromAwesomeBarSearch(String url) {
         // Update the title with the url that was just entered. Don't update the title if
         // the AwesomeBar activity was cancelled, or if the user entered an empty string.
         if (url != null && url.length() > 0) {
             setTitle(url);
         }
 
         if (HardwareUtils.isTablet() || Build.VERSION.SDK_INT < 11) {
@@ -563,30 +567,31 @@ public class BrowserToolbar implements T
         // we had to reinflate the toolbar layout for some reason (device rotation
         // while in awesome screen, activity was killed in background, etc). In this
         // case, we have to ensure the toolbar is in the correct initial state to
         // shrink back.
         if (!mLayout.isSelected()) {
             // Keep the entry highlighted during the animation
             mLayout.setSelected(true);
 
-            final int translation = getAwesomeBarAnimTranslation();
+            final int entryTranslation = getAwesomeBarEntryTranslation();
+            final int curveTranslation = getAwesomeBarCurveTranslation();
 
             proxy = AnimatorProxy.create(mAwesomeBarRightEdge);
-            proxy.setTranslationX(translation);
+            proxy.setTranslationX(entryTranslation);
             proxy = AnimatorProxy.create(mTabs);
-            proxy.setTranslationX(translation);
+            proxy.setTranslationX(curveTranslation);
             proxy = AnimatorProxy.create(mTabsCounter);
-            proxy.setTranslationX(translation);
+            proxy.setTranslationX(curveTranslation);
             proxy = AnimatorProxy.create(mActionItemBar);
-            proxy.setTranslationX(translation);
+            proxy.setTranslationX(curveTranslation);
 
             if (mHasSoftMenuButton) {
                 proxy = AnimatorProxy.create(mMenu);
-                proxy.setTranslationX(translation);
+                proxy.setTranslationX(curveTranslation);
             }
         }
 
         // Restore opacity of content elements in the toolbar immediatelly
         // so that the response is immediate from user interaction in the
         // awesome screen.
         proxy = AnimatorProxy.create(mFavicon);
         proxy.setAlpha(1);
@@ -619,17 +624,16 @@ public class BrowserToolbar implements T
         if (mHasSoftMenuButton)
             contentAnimator.attach(mMenu,
                                    PropertyAnimator.Property.TRANSLATION_X,
                                    0);
 
         contentAnimator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
             @Override
             public void onPropertyAnimationStart() {
-                mTabs.setVisibility(View.VISIBLE);
             }
 
             @Override
             public void onPropertyAnimationEnd() {
                 // Turn off selected state on the entry
                 mLayout.setSelected(false);
 
                 PropertyAnimator buttonsAnimator = new PropertyAnimator(150);
@@ -667,17 +671,18 @@ public class BrowserToolbar implements T
         }
 
         if (mAnimatingEntry)
             return;
 
         final PropertyAnimator contentAnimator = new PropertyAnimator(250);
         contentAnimator.setUseHardwareLayer(false);
 
-        final int translation = getAwesomeBarAnimTranslation();
+        final int entryTranslation = getAwesomeBarEntryTranslation();
+        final int curveTranslation = getAwesomeBarCurveTranslation();
 
         // Keep the entry highlighted during the animation
         mLayout.setSelected(true);
 
         if (mActionItemBar.getVisibility() == View.VISIBLE) {
             contentAnimator.attach(mFavicon,
                                    PropertyAnimator.Property.ALPHA,
                                    0);
@@ -701,41 +706,39 @@ public class BrowserToolbar implements T
                                0);
         contentAnimator.attach(mStop,
                                PropertyAnimator.Property.ALPHA,
                                0);
 
         // Slide the right side elements of the toolbar
         contentAnimator.attach(mAwesomeBarRightEdge,
                                PropertyAnimator.Property.TRANSLATION_X,
-                               translation);
+                               entryTranslation);
         contentAnimator.attach(mTabs,
                                PropertyAnimator.Property.TRANSLATION_X,
-                               translation);
+                               curveTranslation);
         contentAnimator.attach(mTabsCounter,
                                PropertyAnimator.Property.TRANSLATION_X,
-                               translation);
+                               curveTranslation);
         contentAnimator.attach(mActionItemBar,
                                PropertyAnimator.Property.TRANSLATION_X,
-                               translation);
+                               curveTranslation);
 
         if (mHasSoftMenuButton)
             contentAnimator.attach(mMenu,
                                    PropertyAnimator.Property.TRANSLATION_X,
-                                   translation);
+                                   curveTranslation);
 
         contentAnimator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
             @Override
             public void onPropertyAnimationStart() {
             }
 
             @Override
             public void onPropertyAnimationEnd() {
-                mTabs.setVisibility(View.INVISIBLE);
-
                 // Once the entry is fully expanded, start awesome screen
                 mActivity.onSearchRequested();
                 mAnimatingEntry = false;
             }
         });
 
         mAnimatingEntry = true;
         contentAnimator.start();