Loading core/java/android/view/View.java +28 −11 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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) { Loading @@ -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 Loading core/java/android/view/ViewPropertyAnimator.java +2 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -960,6 +961,7 @@ public class ViewPropertyAnimator { @Override public void onAnimationEnd(Animator animation) { mView.setHasTransientState(false); if (mListener != null) { mListener.onAnimationEnd(animation); } Loading Loading
core/java/android/view/View.java +28 −11 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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) { Loading @@ -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 Loading
core/java/android/view/ViewPropertyAnimator.java +2 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -960,6 +961,7 @@ public class ViewPropertyAnimator { @Override public void onAnimationEnd(Animator animation) { mView.setHasTransientState(false); if (mListener != null) { mListener.onAnimationEnd(animation); } Loading