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

Commit 3e0d6c9f authored by Manu Cornet's avatar Manu Cornet Committed by android-build-merger
Browse files

2D recents: fix layout to show 3 tasks on a single line am: 776f6bac

am: d378bc16

Change-Id: Ic79ece663a1b689ae226df861062f1ae623f8efd
parents 5703a0e4 d378bc16
Loading
Loading
Loading
Loading
+23 −5
Original line number Diff line number Diff line
@@ -74,11 +74,8 @@ public class TaskGridLayoutAlgorithm {
            yOffsets = new int[taskCount];

            int layoutTaskCount = Math.min(MAX_LAYOUT_TASK_COUNT, taskCount);

            tasksPerLine = layoutTaskCount < 2 ? 1 : (
                layoutTaskCount < 5 ? 2 : (
                    layoutTaskCount < 7 ? 3 : 4));
            lines = layoutTaskCount < 3 ? 1 : 2;
            tasksPerLine = getTasksPerLine(layoutTaskCount);
            lines = layoutTaskCount < 4 ? 1 : 2;

            // A couple of special cases.
            boolean landscapeWindow = mWindowRect.width() > mWindowRect.height();
@@ -131,6 +128,27 @@ public class TaskGridLayoutAlgorithm {
                    emptySpaceY / 2 + mPaddingTopBottom + (taskHeight + mPaddingTaskView) * yIndex;
            }
        }

        private int getTasksPerLine(int taskCount) {
            switch(taskCount) {
                case 0:
                    return 0;
                case 1:
                    return 1;
                case 2:
                case 4:
                    return 2;
                case 3:
                case 5:
                case 6:
                    return 3;
                case 7:
                case 8:
                    return 4;
                default:
                    throw new IllegalArgumentException("Unsupported task count " + taskCount);
            }
        }
    }

    /**