Merge "Additional null-checks for animations in case child views are removed at an inopportune time." into rvc-dev am: 6d4caab68d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11990653 Change-Id: I1dff41f93733131b742aaded46658479b04cd687
This commit is contained in:
@@ -441,7 +441,10 @@ public class PhysicsAnimationLayout extends FrameLayout {
|
|||||||
|
|
||||||
// Cancel physics animations on the view.
|
// Cancel physics animations on the view.
|
||||||
for (DynamicAnimation.ViewProperty property : mController.getAnimatedProperties()) {
|
for (DynamicAnimation.ViewProperty property : mController.getAnimatedProperties()) {
|
||||||
getAnimationFromView(property, view).cancel();
|
final DynamicAnimation animationFromView = getAnimationFromView(property, view);
|
||||||
|
if (animationFromView != null) {
|
||||||
|
animationFromView.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,13 +502,13 @@ public class PhysicsAnimationLayout extends FrameLayout {
|
|||||||
* Retrieves the animation of the given property from the view at the given index via the view
|
* Retrieves the animation of the given property from the view at the given index via the view
|
||||||
* tag system.
|
* tag system.
|
||||||
*/
|
*/
|
||||||
private SpringAnimation getAnimationAtIndex(
|
@Nullable private SpringAnimation getAnimationAtIndex(
|
||||||
DynamicAnimation.ViewProperty property, int index) {
|
DynamicAnimation.ViewProperty property, int index) {
|
||||||
return getAnimationFromView(property, getChildAt(index));
|
return getAnimationFromView(property, getChildAt(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Retrieves the animation of the given property from the view via the view tag system. */
|
/** Retrieves the animation of the given property from the view via the view tag system. */
|
||||||
private SpringAnimation getAnimationFromView(
|
@Nullable private SpringAnimation getAnimationFromView(
|
||||||
DynamicAnimation.ViewProperty property, View view) {
|
DynamicAnimation.ViewProperty property, View view) {
|
||||||
return (SpringAnimation) view.getTag(getTagIdForProperty(property));
|
return (SpringAnimation) view.getTag(getTagIdForProperty(property));
|
||||||
}
|
}
|
||||||
@@ -536,8 +539,10 @@ public class PhysicsAnimationLayout extends FrameLayout {
|
|||||||
|
|
||||||
final float offset = mController.getOffsetForChainedPropertyAnimation(property);
|
final float offset = mController.getOffsetForChainedPropertyAnimation(property);
|
||||||
if (nextAnimInChain < getChildCount()) {
|
if (nextAnimInChain < getChildCount()) {
|
||||||
getAnimationAtIndex(property, nextAnimInChain)
|
final SpringAnimation nextAnim = getAnimationAtIndex(property, nextAnimInChain);
|
||||||
.animateToFinalPosition(value + offset);
|
if (nextAnim != null) {
|
||||||
|
nextAnim.animateToFinalPosition(value + offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user