Loading src/com/android/launcher3/Launcher.java +29 −5 Original line number Diff line number Diff line Loading @@ -2343,14 +2343,38 @@ public class Launcher extends StatefulActivity<LauncherState> mWorkspace.unlockWallpaperFromDefaultPageOnNextLayout(); } /** * Remove odd number because they are already included when isTwoPanels and add the pair screen * if not present. */ private IntArray filterTwoPanelScreenIds(IntArray orderedScreenIds) { IntSet screenIds = IntSet.wrap(orderedScreenIds); orderedScreenIds.forEach(screenId -> { if (screenId % 2 == 1) { screenIds.remove(screenId); // In case the pair is not added, add it if (!mWorkspace.containsScreenId(screenId - 1)) { screenIds.add(screenId - 1); } } }); return screenIds.getArray(); } private void bindAddScreens(IntArray orderedScreenIds) { if (mDeviceProfile.isTwoPanels) { if (FOLDABLE_SINGLE_PAGE.get()) { orderedScreenIds = filterTwoPanelScreenIds(orderedScreenIds); } else { // Some empty pages might have been removed while the phone was in a single panel // mode, so we want to add those empty pages back. IntSet screenIds = IntSet.wrap(orderedScreenIds); orderedScreenIds.forEach(screenId -> screenIds.add(mWorkspace.getScreenPair(screenId))); orderedScreenIds.forEach( screenId -> screenIds.add(mWorkspace.getScreenPair(screenId))); orderedScreenIds = screenIds.getArray(); } } int count = orderedScreenIds.size(); for (int i = 0; i < count; i++) { Loading src/com/android/launcher3/Workspace.java +8 −0 Original line number Diff line number Diff line Loading @@ -731,6 +731,14 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> }); } /** * Returns if the given screenId is already in the Workspace */ public boolean containsScreenId(int screenId) { return this.mWorkspaceScreens.containsKey(screenId); } /** * Inserts extra empty pages to the end of the existing workspaces. * Usually we add one extra empty screen, but when two panel home is enabled we add Loading tests/src/com/android/launcher3/celllayout/CellLayoutTestCaseReader.java +3 −3 Original line number Diff line number Diff line Loading @@ -63,8 +63,8 @@ public class CellLayoutTestCaseReader { } public static class Board extends TestSection { Point gridSize; String board; public Point gridSize; public String board; public Board(Point gridSize, String board) { super(State.BOARD); Loading Loading @@ -127,7 +127,7 @@ public class CellLayoutTestCaseReader { } } List<TestSection> parse() { public List<TestSection> parse() { List<TestSection> sections = new ArrayList<>(); String[] lines = mTest.split("\n"); Iterator<String> it = Arrays.stream(lines).iterator(); Loading tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class CellLayoutTestUtils { params.getCellX(), params.getCellY(), launcher.getWorkspace().getIdForScreen(cellLayout), CONTAINER_DESKTOP); int screenId = pos.screenId; if (screenId > boards.size() - 1) { for (int j = boards.size(); j <= screenId; j++) { boards.add(new CellLayoutBoard(cellLayout.getCountX(), cellLayout.getCountY())); } CellLayoutBoard board = boards.get(screenId); Loading Loading
src/com/android/launcher3/Launcher.java +29 −5 Original line number Diff line number Diff line Loading @@ -2343,14 +2343,38 @@ public class Launcher extends StatefulActivity<LauncherState> mWorkspace.unlockWallpaperFromDefaultPageOnNextLayout(); } /** * Remove odd number because they are already included when isTwoPanels and add the pair screen * if not present. */ private IntArray filterTwoPanelScreenIds(IntArray orderedScreenIds) { IntSet screenIds = IntSet.wrap(orderedScreenIds); orderedScreenIds.forEach(screenId -> { if (screenId % 2 == 1) { screenIds.remove(screenId); // In case the pair is not added, add it if (!mWorkspace.containsScreenId(screenId - 1)) { screenIds.add(screenId - 1); } } }); return screenIds.getArray(); } private void bindAddScreens(IntArray orderedScreenIds) { if (mDeviceProfile.isTwoPanels) { if (FOLDABLE_SINGLE_PAGE.get()) { orderedScreenIds = filterTwoPanelScreenIds(orderedScreenIds); } else { // Some empty pages might have been removed while the phone was in a single panel // mode, so we want to add those empty pages back. IntSet screenIds = IntSet.wrap(orderedScreenIds); orderedScreenIds.forEach(screenId -> screenIds.add(mWorkspace.getScreenPair(screenId))); orderedScreenIds.forEach( screenId -> screenIds.add(mWorkspace.getScreenPair(screenId))); orderedScreenIds = screenIds.getArray(); } } int count = orderedScreenIds.size(); for (int i = 0; i < count; i++) { Loading
src/com/android/launcher3/Workspace.java +8 −0 Original line number Diff line number Diff line Loading @@ -731,6 +731,14 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T> }); } /** * Returns if the given screenId is already in the Workspace */ public boolean containsScreenId(int screenId) { return this.mWorkspaceScreens.containsKey(screenId); } /** * Inserts extra empty pages to the end of the existing workspaces. * Usually we add one extra empty screen, but when two panel home is enabled we add Loading
tests/src/com/android/launcher3/celllayout/CellLayoutTestCaseReader.java +3 −3 Original line number Diff line number Diff line Loading @@ -63,8 +63,8 @@ public class CellLayoutTestCaseReader { } public static class Board extends TestSection { Point gridSize; String board; public Point gridSize; public String board; public Board(Point gridSize, String board) { super(State.BOARD); Loading Loading @@ -127,7 +127,7 @@ public class CellLayoutTestCaseReader { } } List<TestSection> parse() { public List<TestSection> parse() { List<TestSection> sections = new ArrayList<>(); String[] lines = mTest.split("\n"); Iterator<String> it = Arrays.stream(lines).iterator(); Loading
tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class CellLayoutTestUtils { params.getCellX(), params.getCellY(), launcher.getWorkspace().getIdForScreen(cellLayout), CONTAINER_DESKTOP); int screenId = pos.screenId; if (screenId > boards.size() - 1) { for (int j = boards.size(); j <= screenId; j++) { boards.add(new CellLayoutBoard(cellLayout.getCountX(), cellLayout.getCountY())); } CellLayoutBoard board = boards.get(screenId); Loading