Search in sources :

Example 1 with CONTENT_ALPHA

use of com.android.quickstep.views.RecentsView.CONTENT_ALPHA 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);
        }
    };
}
Also used : RectF(android.graphics.RectF) LauncherLogProto(com.android.launcher3.userevent.nano.LauncherLogProto) Context(android.content.Context) Rect(android.graphics.Rect) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) CONTENT_ALPHA(com.android.quickstep.views.RecentsView.CONTENT_ALPHA) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet) NonNull(androidx.annotation.NonNull) ObjectAnimator(android.animation.ObjectAnimator) FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) Animator(android.animation.Animator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) DeviceProfile(com.android.launcher3.DeviceProfile) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) BiPredicate(java.util.function.BiPredicate) NO_BUTTON(com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON) Nullable(androidx.annotation.Nullable) AnimatorSet(android.animation.AnimatorSet) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener) RecentsView(com.android.quickstep.views.RecentsView) ZOOM_PROGRESS(com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS) LayoutUtils(com.android.quickstep.util.LayoutUtils) FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) Rect(android.graphics.Rect) ObjectAnimator(android.animation.ObjectAnimator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) AnimatorSet(android.animation.AnimatorSet) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet)

Aggregations

Animator (android.animation.Animator)1 AnimatorSet (android.animation.AnimatorSet)1 ObjectAnimator (android.animation.ObjectAnimator)1 Context (android.content.Context)1 Rect (android.graphics.Rect)1 RectF (android.graphics.RectF)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 DeviceProfile (com.android.launcher3.DeviceProfile)1 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)1 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)1 LINEAR (com.android.launcher3.anim.Interpolators.LINEAR)1 LauncherLogProto (com.android.launcher3.userevent.nano.LauncherLogProto)1 NO_BUTTON (com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON)1 FallbackRecentsView (com.android.quickstep.fallback.FallbackRecentsView)1 ZOOM_PROGRESS (com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS)1 LayoutUtils (com.android.quickstep.util.LayoutUtils)1 RemoteAnimationTargetSet (com.android.quickstep.util.RemoteAnimationTargetSet)1 RecentsView (com.android.quickstep.views.RecentsView)1 CONTENT_ALPHA (com.android.quickstep.views.RecentsView.CONTENT_ALPHA)1