Bug 868460 - Mark views to have transient state while animating (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 07 May 2013 18:04:10 +0100
changeset 142084 fa4f3e24bca461f34bc4c8d38740d3222c8f9635
parent 142083 ece17aed454ca58f740f4291cf7c274c998e2cdf
child 142085 85c771c2fffdcb0ac62e1310c3a7b46c8894d7e1
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
bugs868460
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 868460 - Mark views to have transient state while animating (r=mfinkle)
mobile/android/base/PropertyAnimator.java
mobile/android/base/TabsTray.java
--- a/mobile/android/base/PropertyAnimator.java
+++ b/mobile/android/base/PropertyAnimator.java
@@ -1,15 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
+import android.support.v4.view.ViewCompat;
 import android.os.Build;
 import android.os.Handler;
 import android.view.Choreographer;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.AnimationUtils;
 import android.view.animation.DecelerateInterpolator;
 import android.view.animation.Interpolator;
@@ -126,16 +127,18 @@ public class PropertyAnimator implements
                 element.from = element.proxy.getScrollY();
             else if (element.property == Property.SCROLL_X)
                 element.from = element.proxy.getScrollX();
             else if (element.property == Property.WIDTH)
                 element.from = element.proxy.getWidth();
             else if (element.property == Property.HEIGHT)
                 element.from = element.proxy.getHeight();
 
+            ViewCompat.setHasTransientState(element.view, true);
+
             if (shouldEnableHardwareLayer(element))
                 element.view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
             else
                 element.view.setDrawingCacheEnabled(true);
         }
 
         mFramePoster.postFirstAnimationFrame();
 
@@ -151,16 +154,18 @@ public class PropertyAnimator implements
     public void stop(boolean snapToEndPosition) {
         mFramePoster.cancelAnimationFrame();
 
         // Make sure to snap to the end position.
         for (ElementHolder element : mElementsList) {
             if (snapToEndPosition)
                 invalidate(element, element.to);
 
+            ViewCompat.setHasTransientState(element.view, false);
+
             if (shouldEnableHardwareLayer(element))
                 element.view.setLayerType(View.LAYER_TYPE_NONE, null);
             else
                 element.view.setDrawingCacheEnabled(false);
         }
 
         mElementsList.clear();
 
--- a/mobile/android/base/TabsTray.java
+++ b/mobile/android/base/TabsTray.java
@@ -331,18 +331,16 @@ public class TabsTray extends TwoWayView
         final int tabId = tab.id;
         final int originalSize = (isVertical ? view.getHeight() : view.getWidth());
 
         animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
             @Override
             public void onPropertyAnimationStart() { }
             @Override
             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);
 
                 if (isVertical) {
                     proxy.setHeight(originalSize);
                     proxy.setTranslationX(0);
                 } else {
                     proxy.setWidth(originalSize);