Bug 772940 - Add support for height animations with PropertyAnimator (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Fri, 12 Oct 2012 13:22:03 +0100
changeset 110074 476e094d0e6b98ab35e3d78c0fce675dd5245758
parent 110073 929e6a56f22f7e7f52e3b251d14354a8bd48155d
child 110075 d419defdd4254aff4230a15ed8d581dc3f84cb3d
push id23671
push userryanvm@gmail.com
push dateSat, 13 Oct 2012 08:36:40 +0000
treeherdermozilla-central@0be7bfea4744 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs772940
milestone19.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 772940 - Add support for height animations with PropertyAnimator (r=mfinkle)
mobile/android/base/PropertyAnimator.java
--- a/mobile/android/base/PropertyAnimator.java
+++ b/mobile/android/base/PropertyAnimator.java
@@ -21,17 +21,18 @@ import java.util.List;
 public class PropertyAnimator implements Runnable {
     private static final String LOGTAG = "GeckoPropertyAnimator";
 
     public static enum Property {
         ALPHA,
         TRANSLATION_X,
         TRANSLATION_Y,
         SCROLL_X,
-        SCROLL_Y
+        SCROLL_Y,
+        HEIGHT
     }
 
     private class ElementHolder {
         View view;
         AnimatorProxy proxy;
         Property property;
         float from;
         float to;
@@ -111,16 +112,18 @@ public class PropertyAnimator implements
             else if (element.property == Property.TRANSLATION_Y)
                 element.from = element.proxy.getTranslationY();
             else if (element.property == Property.TRANSLATION_X)
                 element.from = element.proxy.getTranslationX();
             else if (element.property == Property.SCROLL_Y)
                 element.from = element.proxy.getScrollY();
             else if (element.property == Property.SCROLL_X)
                 element.from = element.proxy.getScrollX();
+            else if (element.property == Property.HEIGHT)
+                element.from = element.proxy.getHeight();
 
             if (shouldEnableHardwareLayer(element))
                 element.view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
         }
 
         if (mDuration != 0) {
             mFramePoster.postFirstAnimationFrame();
 
@@ -178,16 +181,18 @@ public class PropertyAnimator implements
         else if (element.property == Property.TRANSLATION_Y)
             element.proxy.setTranslationY(delta);
         else if (element.property == Property.TRANSLATION_X)
             element.proxy.setTranslationX(delta);
         else if (element.property == Property.SCROLL_Y)
             element.proxy.scrollTo(element.proxy.getScrollX(), (int) delta);
         else if (element.property == Property.SCROLL_X)
             element.proxy.scrollTo((int) delta, element.proxy.getScrollY());
+        else if (element.property == Property.HEIGHT)
+            element.proxy.setHeight((int) delta);
     }
 
     private static abstract class FramePoster {
         public static FramePoster create(Runnable r) {
             if (Build.VERSION.SDK_INT >= 16)
                 return new FramePosterPostJB(r);
             else
                 return new FramePosterPreJB(r);