use of com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS in project Neo-Launcher by NeoApplications.
the class FallbackActivityControllerHelper method prepareRecentsUI.
@Override
public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible, boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
if (activityVisible) {
return (transitionLength) -> {
};
}
FallbackRecentsView rv = activity.getOverviewPanel();
rv.setContentAlpha(0);
rv.getClearAllButton().setVisibilityAlpha(0);
rv.setDisallowScrollToClearAll(true);
boolean fromState = !animateActivity;
rv.setInOverviewState(fromState);
return new AnimationFactory() {
boolean isAnimatingToRecents = false;
@Override
public void onRemoteAnimationReceived(RemoteAnimationTargetSet targets) {
isAnimatingToRecents = targets != null && targets.isAnimatingHome();
if (!isAnimatingToRecents) {
rv.setContentAlpha(1);
}
createActivityController(getSwipeUpDestinationAndLength(activity.getDeviceProfile(), activity, new Rect()));
}
@Override
public void createActivityController(long transitionLength) {
AnimatorSet animatorSet = new AnimatorSet();
if (isAnimatingToRecents) {
ObjectAnimator anim = ObjectAnimator.ofFloat(rv, CONTENT_ALPHA, 0, 1);
anim.setDuration(transitionLength).setInterpolator(LINEAR);
animatorSet.play(anim);
}
ObjectAnimator anim = ObjectAnimator.ofFloat(rv, ZOOM_PROGRESS, 1, 0);
anim.setDuration(transitionLength).setInterpolator(LINEAR);
animatorSet.play(anim);
AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(animatorSet, transitionLength);
// Since we are changing the start position of the UI, reapply the state, at the end
controller.setEndAction(() -> {
boolean endState = true;
rv.setInOverviewState(controller.getInterpolatedProgress() > 0.5 ? endState : fromState);
});
callback.accept(controller);
}
};
}
Aggregations