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

Commit 720d0b59 authored by Hamster Tian's avatar Hamster Tian Committed by Rashed Abdel-Tawab
Browse files

SystemUI: Make recents grid view accept more than 8 tasks

* SystemUI itself does not limit number of tasks to be shown in grid
  after fb44d212, and we have to handle
  more than 8 tasks in the task stack.

* Since the grid layout algorithm is prepared for only 8 tasks, we just
  drop any task out of this limit, i.e. only tasks with taskIndex =
  [max(0, taskCount-8), taskCount) will be shown.

Change-Id: I8715666397bfe2067735daaaabf2cae1f2600f43
parent 6632ad37
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -198,11 +198,21 @@ public class TaskGridLayoutAlgorithm {
            return transformOut;
        }

        int indexOverflow = Math.max(taskCount - MAX_LAYOUT_TASK_COUNT, 0);
        boolean isTaskViewVisible = taskIndex >= indexOverflow;
        if (!isTaskViewVisible) {
            transformOut.reset();
            transformOut.visible = false;
            return transformOut;
        }

        taskCount = Math.min(MAX_LAYOUT_TASK_COUNT, taskCount);

        TaskGridRectInfo gridInfo = mTaskGridRectInfoList[taskCount - 1];
        mTaskGridRect.set(gridInfo.size);

        int x = gridInfo.xOffsets[taskIndex];
        int y = gridInfo.yOffsets[taskIndex];
        int x = gridInfo.xOffsets[taskIndex - indexOverflow];
        int y = gridInfo.yOffsets[taskIndex - indexOverflow];
        float z = stackLayout.mMaxTranslationZ;

        // We always set the dim alpha to 0, since we don't want grid task views to dim.
@@ -210,10 +220,6 @@ public class TaskGridLayoutAlgorithm {
        // We always set the alpha of the view outline to 1, to make sure the shadow is visible.
        float viewOutlineAlpha = 1f;

        // We also need to invert the index in order to display the most recent tasks first.
        int taskLayoutIndex = taskCount - taskIndex - 1;
        boolean isTaskViewVisible = taskLayoutIndex < MAX_LAYOUT_TASK_COUNT;

        // Fill out the transform
        transformOut.scale = 1f;
        transformOut.alpha = isTaskViewVisible ? 1f : 0f;
@@ -304,6 +310,7 @@ public class TaskGridLayoutAlgorithm {
    }

    public void updateTaskGridRect(int taskCount) {
        taskCount = Math.min(MAX_LAYOUT_TASK_COUNT, taskCount);
        if (taskCount > 0) {
            TaskGridRectInfo gridInfo = mTaskGridRectInfoList[taskCount - 1];
            mTaskGridRect.set(gridInfo.size);