Bug 706835 - Remove the new tab indicator animation on about:home load. r=mfinkle
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 17 Jan 2012 20:47:16 -0800
changeset 84776 6eec3b4644bd983359ce9f0e92ca5de42278d9bc
parent 84775 952ff8dadb81d36ddb12b20d74061890d3e4c66d
child 84777 0673da2a834a2f128380f78788d2a4c45a5f518a
push id21873
push usermlamouri@mozilla.com
push dateWed, 18 Jan 2012 10:29:07 +0000
treeherdermozilla-central@7538f4d4697c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs706835
milestone12.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 706835 - Remove the new tab indicator animation on about:home load. r=mfinkle
mobile/android/base/BrowserToolbar.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -208,40 +208,45 @@ public class BrowserToolbar extends Line
         if (mCount > count) {
             mTabsCount.setInAnimation(mSlideDownIn);
             mTabsCount.setOutAnimation(mSlideDownOut);
         } else if (mCount < count) {
             mTabsCount.setInAnimation(mSlideUpIn);
             mTabsCount.setOutAnimation(mSlideUpOut);
         }
 
-        if (count > 1)
-            mTabs.setImageLevel(count);
-        else
-            mTabs.setImageLevel(0);
-
-        mTabsCount.setVisibility(View.VISIBLE);
+        // Always update the count text even if we're not showing it,
+        // since it can appear in a future animation (e.g. 1 -> 2)
         mTabsCount.setText(String.valueOf(count));
         mCount = count;
 
+        if (count > 1) {
+            // Show tab count if it is greater than 1
+            mTabsCount.setVisibility(View.VISIBLE);
+            // Set image to more tabs dropdown "v"
+            mTabs.setImageLevel(count);
+        }
+
         mHandler.postDelayed(new Runnable() {
             public void run() {
                 ((TextView) mTabsCount.getCurrentView()).setTextColor(mColor);
             }
         }, mDuration);
 
         mHandler.postDelayed(new Runnable() {
             public void run() {
+                // This will only happen when we are animating from 2 -> 1.
+                // We're doing this here (as opposed to above) because we want
+                // the count to disappear _after_ the animation.
                 if (Tabs.getInstance().getCount() == 1) {
+                    // Set image to new tab button "+"
                     mTabs.setImageLevel(1);
                     mTabsCount.setVisibility(View.GONE);
-                    ((TextView) mTabsCount.getCurrentView()).setTextColor(mCounterColor);
-                } else {
-                    ((TextView) mTabsCount.getCurrentView()).setTextColor(mCounterColor);
                 }
+                ((TextView) mTabsCount.getCurrentView()).setTextColor(mCounterColor);
             }
         }, 2 * mDuration);
     }
 
     public void setProgressVisibility(boolean visible) {
         if (visible) {
             mFavicon.setImageDrawable(mProgressSpinner);
             mProgressSpinner.start();