Prevent conflicting animations from starting.
This will prevent the stack from becoming separated and confused in some situations. The root cause was that the BubbleStackView returned false by default in its touch handler, which allowed the bubble views to grab touch events they shouldn't have and start animations. However, those bubbles trying to start the animations should have been prevented by the active controller logic, but it wasn't due to a missing check. Might as well fix both causes! Also, cancel the path animator before starting a new one just in case. Fixes: 155499044 Test: manual Change-Id: Idbdb68dfe3cccc69ae3709faad8d3b7078b354a9
This commit is contained in:
@@ -879,7 +879,7 @@ public class BubbleStackView extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -767,6 +767,10 @@ public class PhysicsAnimationLayout extends FrameLayout {
|
||||
int targetAnimDuration,
|
||||
TimeInterpolator targetAnimInterpolator,
|
||||
Runnable... pathAnimEndActions) {
|
||||
if (mPathAnimator != null) {
|
||||
mPathAnimator.cancel();
|
||||
}
|
||||
|
||||
mPathAnimator = ObjectAnimator.ofFloat(
|
||||
this, mCurrentPointOnPathXProperty, mCurrentPointOnPathYProperty, path);
|
||||
|
||||
|
||||
@@ -459,6 +459,10 @@ public class StackAnimationController extends
|
||||
float friction,
|
||||
SpringForce spring,
|
||||
Float finalPosition) {
|
||||
if (!isActiveController()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d(TAG, String.format("Flinging %s.",
|
||||
PhysicsAnimationLayout.getReadablePropertyName(property)));
|
||||
|
||||
@@ -679,7 +683,7 @@ public class StackAnimationController extends
|
||||
DynamicAnimation.ViewProperty property, SpringForce spring,
|
||||
float vel, float finalPosition, @Nullable Runnable... after) {
|
||||
|
||||
if (mLayout.getChildCount() == 0) {
|
||||
if (mLayout.getChildCount() == 0 || !isActiveController()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user