Search in sources :

Example 1 with AnimatorListeners.forSuccessCallback

use of com.android.launcher3.anim.AnimatorListeners.forSuccessCallback in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsViewStateController method setStateWithAnimationInternal.

@Override
void setStateWithAnimationInternal(@NonNull LauncherState toState, @NonNull StateAnimationConfig config, @NonNull PendingAnimation builder) {
    super.setStateWithAnimationInternal(toState, config, builder);
    if (toState.overviewUi) {
        // While animating into recents, update the visible task data as needed
        builder.addOnFrameCallback(() -> mRecentsView.loadVisibleTaskData(FLAG_UPDATE_ALL));
        mRecentsView.updateEmptyMessage();
    } else {
        builder.addListener(AnimatorListeners.forSuccessCallback(mRecentsView::resetTaskVisuals));
    }
    // Create or dismiss split screen select animations
    LauncherState currentState = mLauncher.getStateManager().getState();
    if (isSplitSelectionState(toState) && !isSplitSelectionState(currentState)) {
        builder.add(mRecentsView.createSplitSelectInitAnimation().buildAnim());
    } else if (!isSplitSelectionState(toState) && isSplitSelectionState(currentState)) {
        builder.add(mRecentsView.cancelSplitSelect(true).buildAnim());
    }
    setAlphas(builder, config, toState);
    builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), LINEAR);
}
Also used : LauncherState(com.android.launcher3.LauncherState)

Example 2 with AnimatorListeners.forSuccessCallback

use of com.android.launcher3.anim.AnimatorListeners.forSuccessCallback in project android_packages_apps_Launcher3 by crdroidandroid.

the class SwipeUpGestureTutorialController method fadeOutFakeTaskView.

/**
 * Fades the task view, optionally after animating to a fake Overview.
 */
void fadeOutFakeTaskView(boolean toOverviewFirst, boolean reset, @Nullable Runnable onEndRunnable) {
    hideFeedback(true);
    cancelRunningAnimation();
    PendingAnimation anim = new PendingAnimation(300);
    if (toOverviewFirst) {
        anim.setFloat(mTaskViewSwipeUpAnimation.getCurrentShift(), AnimatedFloat.VALUE, 1, ACCEL);
        anim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation, boolean isReverse) {
                PendingAnimation fadeAnim = new PendingAnimation(300);
                if (reset) {
                    fadeAnim.setFloat(mTaskViewSwipeUpAnimation.getCurrentShift(), AnimatedFloat.VALUE, 0, ACCEL);
                    fadeAnim.addListener(mResetTaskView);
                } else {
                    fadeAnim.setViewAlpha(mFakeTaskView, 0, ACCEL);
                    fadeAnim.setViewAlpha(mFakePreviousTaskView, 0, ACCEL);
                }
                if (onEndRunnable != null) {
                    fadeAnim.addListener(AnimatorListeners.forSuccessCallback(onEndRunnable));
                }
                AnimatorSet animset = fadeAnim.buildAnim();
                animset.setStartDelay(100);
                animset.start();
                mRunningWindowAnim = RunningWindowAnim.wrap(animset);
            }
        });
    } else {
        if (reset) {
            anim.setFloat(mTaskViewSwipeUpAnimation.getCurrentShift(), AnimatedFloat.VALUE, 0, ACCEL);
            anim.addListener(mResetTaskView);
        } else {
            anim.setViewAlpha(mFakeTaskView, 0, ACCEL);
            anim.setViewAlpha(mFakePreviousTaskView, 0, ACCEL);
        }
        if (onEndRunnable != null) {
            anim.addListener(AnimatorListeners.forSuccessCallback(onEndRunnable));
        }
    }
    AnimatorSet animset = anim.buildAnim();
    animset.start();
    mRunningWindowAnim = RunningWindowAnim.wrap(animset);
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet)

Example 3 with AnimatorListeners.forSuccessCallback

use of com.android.launcher3.anim.AnimatorListeners.forSuccessCallback in project android_packages_apps_Launcher3 by crdroidandroid.

the class SwipeUpGestureTutorialController method animateFakeTaskViewHome.

void animateFakeTaskViewHome(PointF finalVelocity, @Nullable Runnable onEndRunnable) {
    hideFeedback(true);
    cancelRunningAnimation();
    mFakePreviousTaskView.setVisibility(View.INVISIBLE);
    mFakeHotseatView.setVisibility(View.VISIBLE);
    mShowPreviousTasks = false;
    RectFSpringAnim rectAnim = mTaskViewSwipeUpAnimation.handleSwipeUpToHome(finalVelocity);
    // After home animation finishes, fade out and run onEndRunnable.
    PendingAnimation fadeAnim = new PendingAnimation(300);
    fadeAnim.setViewAlpha(mFakeIconView, 0, ACCEL);
    if (onEndRunnable != null) {
        fadeAnim.addListener(AnimatorListeners.forSuccessCallback(onEndRunnable));
    }
    AnimatorSet animset = fadeAnim.buildAnim();
    rectAnim.addAnimatorListener(AnimatorListeners.forSuccessCallback(animset::start));
    mRunningWindowAnim = RunningWindowAnim.wrap(rectAnim);
}
Also used : RectFSpringAnim(com.android.quickstep.util.RectFSpringAnim) PendingAnimation(com.android.launcher3.anim.PendingAnimation) AnimatorSet(android.animation.AnimatorSet)

Aggregations

AnimatorSet (android.animation.AnimatorSet)2 PendingAnimation (com.android.launcher3.anim.PendingAnimation)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 LauncherState (com.android.launcher3.LauncherState)1 RectFSpringAnim (com.android.quickstep.util.RectFSpringAnim)1