Search in sources :

Example 6 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Launcher3 by crdroidandroid.

the class FallbackRecentsView method onPrepareGestureEndAnimation.

/**
 * When the gesture ends and we're going to recents view, we also remove the temporary
 * invisible tile added for the home task. This also pushes the remaining tiles back
 * to the center.
 */
@Override
public void onPrepareGestureEndAnimation(@Nullable AnimatorSet animatorSet, GestureState.GestureEndTarget endTarget) {
    super.onPrepareGestureEndAnimation(animatorSet, endTarget);
    if (mHomeTaskInfo != null && endTarget == RECENTS && animatorSet != null) {
        TaskView tv = getTaskView(mHomeTaskInfo.taskId);
        if (tv != null) {
            PendingAnimation pa = createTaskDismissAnimation(tv, true, false, 150);
            pa.addEndListener(e -> setCurrentTask(-1));
            AnimatorPlaybackController controller = pa.createPlaybackController();
            controller.dispatchOnStart();
            animatorSet.play(controller.getAnimationPlayer());
        }
    }
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) TaskView(com.android.quickstep.views.TaskView) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Example 7 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherTaskbarUIController method createAnimToLauncher.

/**
 * Create Taskbar animation when going from an app to Launcher.
 * @param toState If known, the state we will end up in when reaching Launcher.
 */
public Animator createAnimToLauncher(@Nullable LauncherState toState, long duration) {
    PendingAnimation anim = new PendingAnimation(duration);
    anim.add(mTaskbarAnimationController.createAnimToBackgroundAlpha(0, duration));
    if (toState != null) {
        mTaskbarStateHandler.setStateWithAnimation(toState, new StateAnimationConfig(), anim);
    }
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            mIsAnimatingToLauncher = true;
            mTaskbarView.setHolesAllowedInLayout(true);
            mTaskbarView.updateHotseatItemsVisibility();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mIsAnimatingToLauncher = false;
            setTaskbarViewVisible(false);
        }
    });
    return anim.buildAnim();
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) Animator(android.animation.Animator) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 8 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherActivityInterface method prepareRecentsUI.

@Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState, boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
    notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
    DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) {

        @Override
        protected void createBackgroundToOverviewAnim(BaseQuickstepLauncher activity, PendingAnimation pa) {
            super.createBackgroundToOverviewAnim(activity, pa);
            // Animate the blur and wallpaper zoom
            float fromDepthRatio = BACKGROUND_APP.getDepth(activity);
            float toDepthRatio = OVERVIEW.getDepth(activity);
            pa.addFloat(getDepthController(), new ClampedDepthProperty(fromDepthRatio, toDepthRatio), fromDepthRatio, toDepthRatio, LINEAR);
        }
    };
    BaseQuickstepLauncher launcher = factory.initUI();
    // Since all apps is not visible, we can safely reset the scroll position.
    // This ensures then the next swipe up to all-apps starts from scroll 0.
    launcher.getAppsView().reset(false);
    return factory;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) ClampedDepthProperty(com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty)

Example 9 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Launcher3 by crdroidandroid.

the class StateManager method createAtomicAnimation.

/**
 * Creates an animation representing atomic transitions between the provided states
 */
public AnimatorSet createAtomicAnimation(STATE_TYPE fromState, STATE_TYPE toState, StateAnimationConfig config) {
    PendingAnimation builder = new PendingAnimation(config.duration);
    prepareForAtomicAnimation(fromState, toState, config);
    for (StateHandler handler : mActivity.getStateManager().getStateHandlers()) {
        handler.setStateWithAnimation(toState, config, builder);
    }
    return builder.buildAnim();
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation)

Example 10 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsView method runDismissAnimation.

private void runDismissAnimation(PendingAnimation pendingAnim) {
    AnimatorPlaybackController controller = pendingAnim.createPlaybackController();
    controller.dispatchOnStart();
    controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
    controller.start();
}
Also used : AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Aggregations

PendingAnimation (com.android.launcher3.anim.PendingAnimation)145 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)58 Animator (android.animation.Animator)46 AnimatorSet (android.animation.AnimatorSet)45 Rect (android.graphics.Rect)36 ValueAnimator (android.animation.ValueAnimator)34 Point (android.graphics.Point)32 TextPaint (android.text.TextPaint)32 ObjectAnimator (android.animation.ObjectAnimator)31 Context (android.content.Context)31 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)29 View (android.view.View)29 RecentsView (com.android.quickstep.views.RecentsView)29 DeviceProfile (com.android.launcher3.DeviceProfile)27 RectF (android.graphics.RectF)26 Interpolator (android.view.animation.Interpolator)26 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)25 FloatProperty (android.util.FloatProperty)23 Matrix (android.graphics.Matrix)21 SpringProperty (com.android.launcher3.anim.SpringProperty)21