Loading src/com/android/launcher3/CellLayout.java +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class CellLayout extends ViewGroup { private int mFixedCellWidth; private int mFixedCellHeight; @ViewDebug.ExportedProperty(category = "launcher") private Point mBorderSpace; protected Point mBorderSpace; @ViewDebug.ExportedProperty(category = "launcher") protected int mCountX; Loading src/com/android/launcher3/MultipageCellLayout.java +7 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,13 @@ public class MultipageCellLayout extends CellLayout { } } @Override public int getUnusedHorizontalSpace() { return (int) Math.ceil( (getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth) - ((mCountX - 1) * mBorderSpace.x)) / 2f); } @Override protected void onDraw(Canvas canvas) { if (mLeftBackground.getAlpha() > 0) { Loading src/com/android/launcher3/testing/TestInformationHandler.java +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.launcher3.testing; import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST; import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import android.annotation.TargetApi; Loading Loading @@ -156,7 +157,7 @@ public class TestInformationHandler implements ResourceBasedOverride { case TestProtocol.REQUEST_IS_TWO_PANELS: response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, mDeviceProfile.isTwoPanels); FOLDABLE_SINGLE_PAGE.get() ? false : mDeviceProfile.isTwoPanels); return response; case TestProtocol.REQUEST_GET_HAD_NONTEST_EVENTS: Loading tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java +15 −5 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.launcher3.celllayout; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import android.view.View; import com.android.launcher3.CellLayout; Loading @@ -29,23 +31,31 @@ public class CellLayoutTestUtils { ArrayList<CellLayoutBoard> boards = new ArrayList<>(); int widgetCount = 0; for (CellLayout cellLayout : launcher.getWorkspace().mWorkspaceScreens) { CellLayoutBoard board = new CellLayoutBoard(); int count = cellLayout.getShortcutsAndWidgets().getChildCount(); for (int i = 0; i < count; i++) { View callView = cellLayout.getShortcutsAndWidgets().getChildAt(i); CellLayoutLayoutParams params = (CellLayoutLayoutParams) callView.getLayoutParams(); CellPosMapper.CellPos pos = launcher.getCellPosMapper().mapPresenterToModel( params.getCellX(), params.getCellY(), launcher.getWorkspace().getIdForScreen(cellLayout), CONTAINER_DESKTOP); int screenId = pos.screenId; if (screenId >= boards.size() - 1) { boards.add(new CellLayoutBoard()); } CellLayoutBoard board = boards.get(screenId); // is icon if (callView instanceof DoubleShadowBubbleTextView) { board.addIcon(params.getCellX(), params.getCellY()); board.addIcon(pos.cellX, pos.cellY); } else { // is widget board.addWidget(params.getCellX(), params.getCellY(), params.cellHSpan, params.cellVSpan, (char) ('A' + widgetCount)); board.addWidget(pos.cellX, pos.cellY, params.cellHSpan, params.cellVSpan, (char) ('A' + widgetCount)); widgetCount++; } } boards.add(board); } return boards; } Loading Loading
src/com/android/launcher3/CellLayout.java +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class CellLayout extends ViewGroup { private int mFixedCellWidth; private int mFixedCellHeight; @ViewDebug.ExportedProperty(category = "launcher") private Point mBorderSpace; protected Point mBorderSpace; @ViewDebug.ExportedProperty(category = "launcher") protected int mCountX; Loading
src/com/android/launcher3/MultipageCellLayout.java +7 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,13 @@ public class MultipageCellLayout extends CellLayout { } } @Override public int getUnusedHorizontalSpace() { return (int) Math.ceil( (getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth) - ((mCountX - 1) * mBorderSpace.x)) / 2f); } @Override protected void onDraw(Canvas canvas) { if (mLeftBackground.getAlpha() > 0) { Loading
src/com/android/launcher3/testing/TestInformationHandler.java +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.launcher3.testing; import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST; import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import android.annotation.TargetApi; Loading Loading @@ -156,7 +157,7 @@ public class TestInformationHandler implements ResourceBasedOverride { case TestProtocol.REQUEST_IS_TWO_PANELS: response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, mDeviceProfile.isTwoPanels); FOLDABLE_SINGLE_PAGE.get() ? false : mDeviceProfile.isTwoPanels); return response; case TestProtocol.REQUEST_GET_HAD_NONTEST_EVENTS: Loading
tests/src/com/android/launcher3/celllayout/CellLayoutTestUtils.java +15 −5 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.launcher3.celllayout; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import android.view.View; import com.android.launcher3.CellLayout; Loading @@ -29,23 +31,31 @@ public class CellLayoutTestUtils { ArrayList<CellLayoutBoard> boards = new ArrayList<>(); int widgetCount = 0; for (CellLayout cellLayout : launcher.getWorkspace().mWorkspaceScreens) { CellLayoutBoard board = new CellLayoutBoard(); int count = cellLayout.getShortcutsAndWidgets().getChildCount(); for (int i = 0; i < count; i++) { View callView = cellLayout.getShortcutsAndWidgets().getChildAt(i); CellLayoutLayoutParams params = (CellLayoutLayoutParams) callView.getLayoutParams(); CellPosMapper.CellPos pos = launcher.getCellPosMapper().mapPresenterToModel( params.getCellX(), params.getCellY(), launcher.getWorkspace().getIdForScreen(cellLayout), CONTAINER_DESKTOP); int screenId = pos.screenId; if (screenId >= boards.size() - 1) { boards.add(new CellLayoutBoard()); } CellLayoutBoard board = boards.get(screenId); // is icon if (callView instanceof DoubleShadowBubbleTextView) { board.addIcon(params.getCellX(), params.getCellY()); board.addIcon(pos.cellX, pos.cellY); } else { // is widget board.addWidget(params.getCellX(), params.getCellY(), params.cellHSpan, params.cellVSpan, (char) ('A' + widgetCount)); board.addWidget(pos.cellX, pos.cellY, params.cellHSpan, params.cellVSpan, (char) ('A' + widgetCount)); widgetCount++; } } boards.add(board); } return boards; } Loading