Search in sources :

Example 1 with BACKGROUND_APP

use of com.android.launcher3.LauncherState.BACKGROUND_APP in project android_packages_apps_Launcher3 by crdroidandroid.

the class StaggeredWorkspaceAnim method prepareToAnimate.

/**
 * Setup workspace with 0 duration to prepare for our staggered animation.
 */
private void prepareToAnimate(Launcher launcher, boolean animateOverviewScrim) {
    StateAnimationConfig config = new StateAnimationConfig();
    config.animFlags = SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER | SKIP_SCRIM;
    config.duration = 0;
    // setRecentsAttachedToAppWindow() will animate recents out.
    launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();
    // Stop scrolling so that it doesn't interfere with the translation offscreen.
    launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
    if (animateOverviewScrim) {
        launcher.getWorkspace().getStateTransitionAnimation().setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config);
    }
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) RecentsView(com.android.quickstep.views.RecentsView)

Example 2 with BACKGROUND_APP

use of com.android.launcher3.LauncherState.BACKGROUND_APP in project android_packages_apps_Launcher3 by crdroidandroid.

the class WorkspaceRevealAnim method prepareToAnimate.

/**
 * Setup workspace with 0 duration.
 */
private void prepareToAnimate(Launcher launcher, boolean animateOverviewScrim) {
    StateAnimationConfig config = new StateAnimationConfig();
    config.animFlags = SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER | SKIP_SCRIM;
    config.duration = 0;
    // setRecentsAttachedToAppWindow() will animate recents out.
    launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();
    // Stop scrolling so that it doesn't interfere with the translation offscreen.
    launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
    if (animateOverviewScrim) {
        launcher.getWorkspace().getStateTransitionAnimation().setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config);
    }
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) RecentsView(com.android.quickstep.views.RecentsView)

Example 3 with BACKGROUND_APP

use of com.android.launcher3.LauncherState.BACKGROUND_APP in project android_packages_apps_Launcher3 by crdroidandroid.

the class AbsSwipeUpHandler method onLauncherStart.

private void onLauncherStart() {
    final T activity = mActivityInterface.getCreatedActivity();
    if (mActivity != activity) {
        return;
    }
    if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
        return;
    }
    // RecentsView never updates the display rotation until swipe-up, force update
    // RecentsOrientedState before passing to TaskViewSimulator.
    mRecentsView.updateRecentsRotation();
    mTaskViewSimulator.setOrientationState(mRecentsView.getPagedViewOrientedState());
    // as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
    if (mGestureState.getEndTarget() != HOME) {
        Runnable initAnimFactory = () -> {
            mAnimationFactory = mActivityInterface.prepareRecentsUI(mDeviceState, mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated);
            maybeUpdateRecentsAttachedState(false);
        };
        if (mWasLauncherAlreadyVisible) {
            // Launcher is visible, but might be about to stop. Thus, if we prepare recents
            // now, it might get overridden by moveToRestState() in onStop(). To avoid this,
            // wait until the next gesture (and possibly launcher) starts.
            mStateCallback.runOnceAtState(STATE_GESTURE_STARTED, initAnimFactory);
        } else {
            initAnimFactory.run();
        }
    }
    AbstractFloatingView.closeAllOpenViewsExcept(activity, mWasLauncherAlreadyVisible, AbstractFloatingView.TYPE_LISTENER);
    if (mWasLauncherAlreadyVisible) {
        mStateCallback.setState(STATE_LAUNCHER_DRAWN);
    } else {
        Object traceToken = TraceHelper.INSTANCE.beginSection("WTS-init");
        View dragLayer = activity.getDragLayer();
        dragLayer.getViewTreeObserver().addOnDrawListener(new OnDrawListener() {

            boolean mHandled = false;

            @Override
            public void onDraw() {
                if (mHandled) {
                    return;
                }
                mHandled = true;
                TraceHelper.INSTANCE.endSection(traceToken);
                dragLayer.post(() -> dragLayer.getViewTreeObserver().removeOnDrawListener(this));
                if (activity != mActivity) {
                    return;
                }
                mStateCallback.setState(STATE_LAUNCHER_DRAWN);
            }
        });
    }
    activity.getRootView().setOnApplyWindowInsetsListener(this);
    mStateCallback.setState(STATE_LAUNCHER_STARTED);
}
Also used : LAUNCHER_QUICKSWITCH_RIGHT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT) STATE_END_TARGET_SET(com.android.quickstep.GestureState.STATE_END_TARGET_SET) LAUNCHER_QUICKSWITCH_LEFT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT) LENGTH_SHORT(android.widget.Toast.LENGTH_SHORT) OnDrawListener(android.view.ViewTreeObserver.OnDrawListener) TaskView(com.android.quickstep.views.TaskView) View(android.view.View) RecentsView(com.android.quickstep.views.RecentsView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

Aggregations

RecentsView (com.android.quickstep.views.RecentsView)3 StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)2 View (android.view.View)1 OnDrawListener (android.view.ViewTreeObserver.OnDrawListener)1 LENGTH_SHORT (android.widget.Toast.LENGTH_SHORT)1 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)1 LAUNCHER_QUICKSWITCH_LEFT (com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT)1 LAUNCHER_QUICKSWITCH_RIGHT (com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT)1 STATE_END_TARGET_SET (com.android.quickstep.GestureState.STATE_END_TARGET_SET)1 TaskView (com.android.quickstep.views.TaskView)1