Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e5bd8da authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Make ViewPropertyAnimator ListView-animation-capable"

parents c9496495 563d4f2d
Loading
Loading
Loading
Loading
+28 −11
Original line number Diff line number Diff line
@@ -2471,6 +2471,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    })
    int mSystemUiVisibility;
    /**
     * Reference count for transient state.
     * @see #setHasTransientState(boolean)
     */
    int mTransientStateCount = 0;
    /**
     * Count of how many windows this view has been attached to.
     */
@@ -5400,13 +5406,23 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    /**
     * Set whether this view is currently tracking transient state that the
     * framework should attempt to preserve when possible.
     * framework should attempt to preserve when possible. This flag is reference counted,
     * so every call to setHasTransientState(true) should be paired with a later call
     * to setHasTransientState(false).
     *
     * @param hasTransientState true if this view has transient state
     */
    public void setHasTransientState(boolean hasTransientState) {
        if (hasTransientState() == hasTransientState) return;
        mTransientStateCount = hasTransientState ? mTransientStateCount + 1 :
                mTransientStateCount - 1;
        if (mTransientStateCount < 0) {
            mTransientStateCount = 0;
            Log.e(VIEW_LOG_TAG, "hasTransientState decremented below 0: " +
                    "unmatched pair of setHasTransientState calls");
        }
        if ((hasTransientState && mTransientStateCount == 1) ||
                (hasTransientState && mTransientStateCount == 0)) {
            // update flag if we've just incremented up from 0 or decremented down to 0
            mPrivateFlags2 = (mPrivateFlags2 & ~HAS_TRANSIENT_STATE) |
                    (hasTransientState ? HAS_TRANSIENT_STATE : 0);
            if (mParent != null) {
@@ -5418,6 +5434,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
                }
            }
        }
    }
    /**
     * If this view doesn't do any drawing on its own, set this flag to
+2 −0
Original line number Diff line number Diff line
@@ -714,6 +714,7 @@ public class ViewPropertyAnimator {
     * value accordingly.
     */
    private void startAnimation() {
        mView.setHasTransientState(true);
        ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
        ArrayList<NameValuesHolder> nameValueList =
                (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
@@ -960,6 +961,7 @@ public class ViewPropertyAnimator {

        @Override
        public void onAnimationEnd(Animator animation) {
            mView.setHasTransientState(false);
            if (mListener != null) {
                mListener.onAnimationEnd(animation);
            }