use of com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR in project android_packages_apps_Trebuchet by LineageOS.
the class AppToOverviewAnimationProvider method createWindowAnimation.
/**
* Create remote window animation from the currently running app to the overview panel.
*
* @param appTargets the target apps
* @return animation from app to overview
*/
@Override
public AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets) {
PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
if (mActivity == null) {
Log.e(TAG, "Animation created, before activity");
return pa.buildAnim();
}
mRecentsView.setRunningTaskIconScaledDown(true);
pa.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
mActivityInterface.onSwipeUpToRecentsComplete();
mRecentsView.animateUpRunningTaskIconScale();
}
});
DepthController depthController = mActivityInterface.getDepthController();
if (depthController != null) {
pa.addFloat(depthController, DEPTH, BACKGROUND_APP.getDepth(mActivity), OVERVIEW.getDepth(mActivity), TOUCH_RESPONSE_INTERPOLATOR);
}
RemoteAnimationTargets targets = new RemoteAnimationTargets(appTargets, wallpaperTargets, MODE_CLOSING);
// Use the top closing app to determine the insets for the animation
RemoteAnimationTargetCompat runningTaskTarget = mTargetTask == null ? null : targets.findTask(mTargetTask.taskId);
if (runningTaskTarget == null) {
Log.e(TAG, "No closing app");
return pa.buildAnim();
}
TaskViewSimulator tsv = new TaskViewSimulator(mActivity, mRecentsView.getSizeStrategy());
tsv.setDp(mActivity.getDeviceProfile());
tsv.setPreview(runningTaskTarget);
tsv.setLayoutRotation(mRecentsView.getPagedViewOrientedState().getTouchRotation(), mRecentsView.getPagedViewOrientedState().getDisplayRotation());
TransformParams params = new TransformParams().setTargetSet(targets).setSyncTransactionApplier(new SurfaceTransactionApplier(mActivity.getRootView()));
AnimatedFloat recentsAlpha = new AnimatedFloat(() -> {
});
params.setBaseBuilderProxy((builder, app, p) -> builder.withAlpha(recentsAlpha.value));
Interpolator taskInterpolator;
if (targets.isAnimatingHome()) {
params.setHomeBuilderProxy((builder, app, p) -> builder.withAlpha(1 - p.getProgress()));
taskInterpolator = TOUCH_RESPONSE_INTERPOLATOR;
pa.addFloat(recentsAlpha, AnimatedFloat.VALUE, 0, 1, TOUCH_RESPONSE_INTERPOLATOR);
} else {
// When animation from app to recents, the recents layer is drawn on top of the app. To
// prevent the overlap, we animate the task first and then quickly fade in the recents.
taskInterpolator = clampToProgress(TOUCH_RESPONSE_INTERPOLATOR, 0, 0.8f);
pa.addFloat(recentsAlpha, AnimatedFloat.VALUE, 0, 1, clampToProgress(TOUCH_RESPONSE_INTERPOLATOR, 0.8f, 1));
}
pa.addFloat(params, TransformParams.PROGRESS, 0, 1, taskInterpolator);
tsv.addAppToOverviewAnim(pa, taskInterpolator);
pa.addOnFrameCallback(() -> tsv.apply(params));
return pa.buildAnim();
}
Aggregations