Adding support for skipping animation cancel on reapply

Bug: 314279319
Test: Verified on device
Flag: None
Change-Id: I0a6e9eef77a1d917c0fce7d4bddd079ceeb10c99
This commit is contained in:
Sunny Goyal
2024-01-08 15:19:49 -08:00
parent 8d42081b23
commit 98b5e1f077
7 changed files with 63 additions and 34 deletions
@@ -40,8 +40,19 @@ public class StateAnimationConfig {
public static final int SKIP_DEPTH_CONTROLLER = 1 << 2;
public static final int SKIP_SCRIM = 1 << 3;
@IntDef(flag = true, value = {
USER_CONTROLLED,
HANDLE_STATE_APPLY
})
@Retention(RetentionPolicy.SOURCE)
public @interface AnimationPropertyFlags {}
// Indicates that the animation is controlled by the user
public static final int USER_CONTROLLED = 1 << 0;
// Indicates that he animation can survive state UI resets due to inset or config changes
public static final int HANDLE_STATE_APPLY = 1 << 1;
public long duration;
public boolean userControlled;
public @AnimationPropertyFlags int animProps = 0;
public @AnimationFlags int animFlags = 0;
@@ -105,12 +116,16 @@ public class StateAnimationConfig {
public void copyTo(StateAnimationConfig target) {
target.duration = duration;
target.animFlags = animFlags;
target.userControlled = userControlled;
target.animProps = animProps;
for (int i = 0; i < ANIM_TYPES_COUNT; i++) {
target.mInterpolators[i] = mInterpolators[i];
}
}
public boolean isUserControlled() {
return (animProps & USER_CONTROLLED) != 0;
}
/**
* Returns the interpolator set for animId or fallback if nothing is set
*