Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78010c19 authored by Sreyas's avatar Sreyas
Browse files

Refactoring RecentsView to handle non-TaskViews

Change-Id: I0bc28ef670a1dad9a3912ca5360c9bab18afd4b2
parent d61f73d9
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.util.LayoutUtils;
@@ -69,8 +68,16 @@ public class BackgroundAppState extends OverviewState {
        if (taskCount == 0) {
            return super.getOverviewScaleAndTranslation(launcher);
        }
        TaskView dummyTask = recentsView.getTaskViewAt(Utilities.boundToRange(
                recentsView.getCurrentPage(), 0, taskCount - 1));
        TaskView dummyTask;
        if (recentsView.getCurrentPage() >= 0) {
            if (recentsView.getCurrentPage() <= taskCount - 1) {
                dummyTask = recentsView.getCurrentPageTaskView();
            } else {
                dummyTask = recentsView.getTaskViewAt(taskCount - 1);
            }
        } else {
            dummyTask = recentsView.getTaskViewAt(0);
        }
        return recentsView.getTempClipAnimationHelper().updateForFullscreenOverview(dummyTask)
                .getScaleAndTranslation();
    }
+4 −4
Original line number Diff line number Diff line
@@ -47,9 +47,9 @@ public final class PortraitOverviewStateTouchHelper {
     * @return true if we should intercept the motion event
     */
    boolean canInterceptTouch(MotionEvent ev) {
        if (mRecentsView.getChildCount() > 0) {
        if (mRecentsView.getTaskViewCount() > 0) {
            // Allow swiping up in the gap between the hotseat and overview.
            return ev.getY() >= mRecentsView.getChildAt(0).getBottom();
            return ev.getY() >= mRecentsView.getTaskViewAt(0).getBottom();
        } else {
            // If there are no tasks, we only intercept if we're below the hotseat height.
            return isTouchOverHotseat(mLauncher, ev);
@@ -63,7 +63,7 @@ public final class PortraitOverviewStateTouchHelper {
     * @return true if going back should take the user to the currently running task
     */
    boolean shouldSwipeDownReturnToApp() {
        TaskView taskView = mRecentsView.getTaskViewAt(mRecentsView.getNextPage());
        TaskView taskView = mRecentsView.getNextPageTaskView();
        return taskView != null && mRecentsView.shouldSwipeDownLaunchApp();
    }

@@ -76,7 +76,7 @@ public final class PortraitOverviewStateTouchHelper {
     */
    PendingAnimation createSwipeDownToTaskAppAnimation(long duration) {
        mRecentsView.setCurrentPage(mRecentsView.getPageNearestToCenterOfScreen());
        TaskView taskView = mRecentsView.getTaskViewAt(mRecentsView.getCurrentPage());
        TaskView taskView = mRecentsView.getCurrentPageTaskView();
        if (taskView == null) {
            throw new IllegalStateException("There is no task view to animate to.");
        }
+0 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.QuickStepContract;

/**
 * Handles quick switching to a recent task from the home screen.
+2 −2
Original line number Diff line number Diff line
@@ -227,10 +227,10 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
        // Launch the task user scrolled to (mRecentsView.getNextPage()).
        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            // We finish recents animation inside launchTask() when live tile is enabled.
            mRecentsView.getTaskViewAt(mRecentsView.getNextPage()).launchTask(false /* animate */,
            mRecentsView.getNextPageTaskView().launchTask(false /* animate */,
                    true /* freezeTaskList */);
        } else {
            int taskId = mRecentsView.getTaskViewAt(mRecentsView.getNextPage()).getTask().key.id;
            int taskId = mRecentsView.getNextPageTaskView().getTask().key.id;
            mFinishingRecentsAnimationForNewTaskId = taskId;
            mRecentsAnimationWrapper.finish(true /* toRecents */, () -> {
                if (!mCanceled) {
+3 −4
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
                        INDEX_RECENTS_FADE_ANIM, attached ? 1 : 0);

                int runningTaskIndex = recentsView.getRunningTaskIndex();
                if (runningTaskIndex == 0) {
                if (runningTaskIndex == recentsView.getTaskViewStartIndex()) {
                    // If we are on the first task (we haven't quick switched), translate recents in
                    // from the side. Calculate the start translation based on current scale/scroll.
                    float currScale = recentsView.getScaleX();
@@ -351,8 +351,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
    private void playScaleDownAnim(AnimatorSet anim, Launcher launcher, LauncherState fromState,
            LauncherState endState) {
        RecentsView recentsView = launcher.getOverviewPanel();
        TaskView v = recentsView.getTaskViewAt(recentsView.getCurrentPage());
        if (v == null) {
        if (recentsView.getCurrentPageTaskView() == null) {
            return;
        }

@@ -380,7 +379,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
            // recents as a whole needs to translate further to keep up with the app window.
            TaskView runningTaskView = recentsView.getRunningTaskView();
            if (runningTaskView == null) {
                runningTaskView = recentsView.getTaskViewAt(recentsView.getCurrentPage());
                runningTaskView = recentsView.getCurrentPageTaskView();
            }
            TimeInterpolator oldInterpolator = translateY.getInterpolator();
            Rect fallbackInsets = launcher.getDeviceProfile().getInsets();
Loading