Search in sources :

Example 1 with RecentsView

use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.

the class BaseQuickstepLauncher method onScreenOff.

@Override
protected void onScreenOff() {
    super.onScreenOff();
    if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
        RecentsView recentsView = getOverviewPanel();
        recentsView.finishRecentsAnimation(true, /* toRecents */
        null);
    }
}
Also used : RecentsView(com.android.quickstep.views.RecentsView)

Example 2 with RecentsView

use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.

the class BaseActivityInterface method switchRunningTaskViewToScreenshot.

public void switchRunningTaskViewToScreenshot(ThumbnailData thumbnailData, Runnable runnable) {
    ACTIVITY_TYPE activity = getCreatedActivity();
    if (activity == null) {
        return;
    }
    RecentsView recentsView = activity.getOverviewPanel();
    if (recentsView == null) {
        if (runnable != null) {
            runnable.run();
        }
        return;
    }
    recentsView.switchToScreenshot(thumbnailData, runnable);
}
Also used : RecentsView(com.android.quickstep.views.RecentsView)

Example 3 with RecentsView

use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.

the class OverviewCommandHelper method executeCommand.

/**
 * Executes the task and returns true if next task can be executed. If false, then the next
 * task is deferred until {@link #scheduleNextTask} is called
 */
private <T extends StatefulActivity<?>> boolean executeCommand(CommandInfo cmd) {
    BaseActivityInterface<?, T> activityInterface = mOverviewComponentObserver.getActivityInterface();
    RecentsView recents = activityInterface.getVisibleRecentsView();
    if (recents == null) {
        if (cmd.type == TYPE_HIDE) {
            // already hidden
            return true;
        }
    } else {
        switch(cmd.type) {
            case TYPE_SHOW:
                // already visible
                return true;
            case TYPE_HIDE:
                {
                    int currentPage = recents.getNextPage();
                    TaskView tv = (currentPage >= 0 && currentPage < recents.getTaskViewCount()) ? (TaskView) recents.getPageAt(currentPage) : null;
                    return launchTask(recents, tv, cmd);
                }
            case TYPE_TOGGLE:
                return launchTask(recents, getNextTask(recents), cmd);
        }
    }
    if (activityInterface.switchToRecentsIfVisible(() -> scheduleNextTask(cmd))) {
        // If successfully switched, wait until animation finishes
        return false;
    }
    final T activity = activityInterface.getCreatedActivity();
    if (activity != null) {
        InteractionJankMonitorWrapper.begin(activity.getRootView(), InteractionJankMonitorWrapper.CUJ_QUICK_SWITCH);
    }
    GestureState gestureState = mService.createGestureState(GestureState.DEFAULT_STATE);
    gestureState.setHandlingAtomicEvent(true);
    AbsSwipeUpHandler interactionHandler = mService.getSwipeUpHandlerFactory().newHandler(gestureState, cmd.createTime);
    interactionHandler.setGestureEndCallback(() -> onTransitionComplete(cmd, interactionHandler));
    interactionHandler.initWhenReady();
    RecentsAnimationListener recentAnimListener = new RecentsAnimationListener() {

        @Override
        public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) {
            interactionHandler.onGestureEnded(0, new PointF(), new PointF());
            cmd.removeListener(this);
        }

        @Override
        public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
            interactionHandler.onGestureCancelled();
            cmd.removeListener(this);
            RecentsView createdRecents = activityInterface.getCreatedActivity().getOverviewPanel();
            if (createdRecents != null) {
                createdRecents.onRecentsAnimationComplete();
            }
        }
    };
    if (mTaskAnimationManager.isRecentsAnimationRunning()) {
        cmd.mActiveCallbacks = mTaskAnimationManager.continueRecentsAnimation(gestureState);
        cmd.mActiveCallbacks.addListener(interactionHandler);
        mTaskAnimationManager.notifyRecentsAnimationState(interactionHandler);
        interactionHandler.onGestureStarted(true);
        cmd.mActiveCallbacks.addListener(recentAnimListener);
        mTaskAnimationManager.notifyRecentsAnimationState(recentAnimListener);
    } else {
        Intent intent = new Intent(interactionHandler.getLaunchIntent());
        intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, gestureState.getGestureId());
        cmd.mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(gestureState, intent, interactionHandler);
        interactionHandler.onGestureStarted(false);
        cmd.mActiveCallbacks.addListener(recentAnimListener);
    }
    Trace.beginAsyncSection(TRANSITION_NAME, 0);
    return false;
}
Also used : TaskView(com.android.quickstep.views.TaskView) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) PointF(android.graphics.PointF) RecentsView(com.android.quickstep.views.RecentsView) Intent(android.content.Intent) RecentsAnimationListener(com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener)

Example 4 with RecentsView

use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsActivity method startHome.

public void startHome() {
    if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
        RecentsView recentsView = getOverviewPanel();
        recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true, this::startHomeInternal));
    } else {
        startHomeInternal();
    }
}
Also used : FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) RecentsView(com.android.quickstep.views.RecentsView)

Example 5 with RecentsView

use of com.android.quickstep.views.RecentsView in project android_packages_apps_Launcher3 by crdroidandroid.

the class NavBarToHomeTouchController method initCurrentAnimation.

private void initCurrentAnimation() {
    long accuracy = (long) (getShiftRange() * 2);
    final PendingAnimation builder = new PendingAnimation(accuracy);
    if (mStartState.overviewUi) {
        RecentsView recentsView = mLauncher.getOverviewPanel();
        AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder);
        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            builder.addOnFrameCallback(recentsView::redrawLiveTile);
        }
        AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_TASK_MENU);
    } else if (mStartState == ALL_APPS) {
        AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
        builder.setFloat(allAppsController, ALL_APPS_PROGRESS, -mPullbackDistance / allAppsController.getShiftRange(), PULLBACK_INTERPOLATOR);
        // Slightly fade out all apps content to further distinguish from scrolling.
        StateAnimationConfig config = new StateAnimationConfig();
        config.duration = accuracy;
        config.setInterpolator(StateAnimationConfig.ANIM_ALL_APPS_FADE, Interpolators.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
        allAppsController.setAlphas(mEndState, config, builder);
    }
    AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
    if (topView != null) {
        topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder);
    }
    mCurrentAnimation = builder.createPlaybackController();
    mCurrentAnimation.getTarget().addListener(newCancelListener(this::clearState));
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) RecentsView(com.android.quickstep.views.RecentsView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

Aggregations

RecentsView (com.android.quickstep.views.RecentsView)31 StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)4 TaskView (com.android.quickstep.views.TaskView)4 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)3 DeviceProfile (com.android.launcher3.DeviceProfile)3 ObjectAnimator (android.animation.ObjectAnimator)2 ValueAnimator (android.animation.ValueAnimator)2 Context (android.content.Context)2 Intent (android.content.Intent)2 Rect (android.graphics.Rect)2 View (android.view.View)2 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)2 Launcher (com.android.launcher3.Launcher)2 LauncherState (com.android.launcher3.LauncherState)2 Workspace (com.android.launcher3.Workspace)2 AllAppsTransitionController (com.android.launcher3.allapps.AllAppsTransitionController)2 PendingAnimation (com.android.launcher3.anim.PendingAnimation)2 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)2 ThumbnailData (com.android.systemui.shared.recents.model.ThumbnailData)2 Animator (android.animation.Animator)1