launcher: correct page spacing for multiple panels
This fixes 2 things:
- adding the correct space between pages as insets (eg camera) were
being discarded
- adding the space between pages instead of between panels as was before
This solution should work with more panels and don't create problems for
phones, where panels = 1.
Fixes 193194192
Test: manual testing in unfolded state in portrait and landscape, both
rotations
Change-Id: Ia3b148ceb773c6d5b6f8848ced07d7f9c1459e92
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 20f5f9b..74b0d9c 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -709,6 +709,7 @@
final int scrollOffsetStart = mOrientationHandler.getScrollOffsetStart(this, mInsets);
final int scrollOffsetEnd = mOrientationHandler.getScrollOffsetEnd(this, mInsets);
boolean pageScrollChanged = false;
+ int panelCount = getPanelCount();
for (int i = startIndex, childStart = scrollOffsetStart; i != endIndex; i += delta) {
final View child = getPageAt(i);
@@ -726,11 +727,15 @@
pageScrollChanged = true;
outPageScrolls[i] = pageScroll;
}
- childStart += primaryDimension + mPageSpacing + getChildGap();
+ childStart += primaryDimension + getChildGap();
+
+ // This makes sure that the space is added after the page, not after each panel
+ if (i % panelCount == panelCount - 1) {
+ childStart += mPageSpacing;
+ }
}
}
- int panelCount = getPanelCount();
if (panelCount > 1) {
for (int i = 0; i < childCount; i++) {
// In case we have multiple panels, always use left panel's page scroll for all