Bug 772940 - Slide tab rows to fill gap of removed tab (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Fri, 12 Oct 2012 13:22:03 +0100
changeset 110207 d419defdd4254aff4230a15ed8d581dc3f84cb3d
parent 110206 476e094d0e6b98ab35e3d78c0fce675dd5245758
child 110208 bab48a4742e75d7531447c29b9a42dfd82980293
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmfinkle
bugs772940
milestone19.0a1
Bug 772940 - Slide tab rows to fill gap of removed tab (r=mfinkle)
mobile/android/base/TabsTray.java
--- a/mobile/android/base/TabsTray.java
+++ b/mobile/android/base/TabsTray.java
@@ -274,27 +274,43 @@ public class TabsTray extends LinearLayo
             return;
 
         PropertyAnimator animator = new PropertyAnimator(ANIMATION_DURATION);
         animator.attach(view, Property.ALPHA, 0);
         animator.attach(view, Property.TRANSLATION_X, x);
 
         mWaitingForClose = true;
 
+        animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
+            public void onPropertyAnimationStart() { }
+            public void onPropertyAnimationEnd() {
+                animateFinishClose(view);
+            }
+        });
+
+        animator.start();
+    }
+
+    private void animateFinishClose(final View view) {
+        PropertyAnimator animator = new PropertyAnimator(ANIMATION_DURATION);
+        animator.attach(view, Property.HEIGHT, 1);
+
         TabRow tab = (TabRow)view.getTag();
         final int tabId = tab.id;
+        final int originalHeight = view.getHeight();
 
         animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
             public void onPropertyAnimationStart() { }
             public void onPropertyAnimationEnd() {
                 // Reset view presentation as it will be recycled in the
                 // list view by the adapter.
                 AnimatorProxy proxy = AnimatorProxy.create(view);
                 proxy.setAlpha(1);
                 proxy.setTranslationX(0);
+                proxy.setHeight(originalHeight);
 
                 Tabs tabs = Tabs.getInstance();
                 Tab tab = tabs.getTab(tabId);
                 tabs.closeTab(tab);
             }
         });
 
         animator.start();