Search in sources :

Example 6 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project Neo-Launcher by NeoApplications.

the class LauncherActivityControllerHelper method createActivityControllerInternal.

private void createActivityControllerInternal(Launcher activity, LauncherState fromState, long transitionLength, Consumer<AnimatorPlaybackController> callback) {
    LauncherState endState = OVERVIEW;
    if (fromState == endState) {
        return;
    }
    AnimatorSet anim = new AnimatorSet();
    if (!activity.getDeviceProfile().isVerticalBarLayout() && SysUINavigationMode.getMode(activity) != Mode.NO_BUTTON) {
        // Don't animate the shelf when the mode is NO_BUTTON, because we update it atomically.
        anim.play(activity.getStateManager().createStateElementAnimation(INDEX_SHELF_ANIM, fromState.getVerticalProgress(activity), endState.getVerticalProgress(activity)));
    }
    playScaleDownAnim(anim, activity, fromState, endState);
    anim.setDuration(transitionLength * 2);
    anim.setInterpolator(LINEAR);
    AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(anim, transitionLength * 2);
    activity.getStateManager().setCurrentUserControlledAnimation(controller);
    // Since we are changing the start position of the UI, reapply the state, at the end
    controller.setEndAction(() -> {
        activity.getStateManager().goToState(controller.getInterpolatedProgress() > 0.5 ? endState : fromState, false);
    });
    callback.accept(controller);
}
Also used : LauncherState(com.android.launcher3.LauncherState) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) AnimatorSet(android.animation.AnimatorSet)

Example 7 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsView method createAllTasksDismissAnimation.

public PendingAnimation createAllTasksDismissAnimation(long duration) {
    if (FeatureFlags.IS_STUDIO_BUILD && mPendingAnimation != null) {
        throw new IllegalStateException("Another pending animation is still running");
    }
    PendingAnimation anim = new PendingAnimation(duration);
    int count = getTaskViewCount();
    for (int i = 0; i < count; i++) {
        addDismissedTaskAnimations(getTaskViewAt(i), duration, anim);
    }
    mPendingAnimation = anim;
    mPendingAnimation.addEndListener((endState) -> {
        if (endState.isSuccess) {
            // Remove all the task views now
            ActivityManagerWrapper.getInstance().removeAllRecentTasks();
            removeTasksViewsAndClearAllButton();
            startHome();
        }
        mPendingAnimation = null;
    });
    return anim;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Aggregations

AnimatorSet (android.animation.AnimatorSet)3 ObjectAnimator (android.animation.ObjectAnimator)3 Point (android.graphics.Point)3 Rect (android.graphics.Rect)3 TextPaint (android.text.TextPaint)3 LauncherState (com.android.launcher3.LauncherState)3 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)3 PendingAnimation (com.android.launcher3.anim.PendingAnimation)3 Animator (android.animation.Animator)2 Context (android.content.Context)2 RectF (android.graphics.RectF)2 FloatProperty (android.util.FloatProperty)2 View (android.view.View)2 ListView (android.widget.ListView)2 Nullable (androidx.annotation.Nullable)2 DeviceProfile (com.android.launcher3.DeviceProfile)2 PagedView (com.android.launcher3.PagedView)2 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)2 LINEAR (com.android.launcher3.anim.Interpolators.LINEAR)2 EndState (com.android.launcher3.anim.PendingAnimation.EndState)2