launcher: use scalable grid in 4x4
Many changes are required to make scalable displays work correctly on
foldables. This first one is making sure that the correct number of
columns is used when calculating the used width for scalable grid. The
spaces around the workspace are not final yet.
Bug: 191879424
Test: manual
Change-Id: Idc41ed004580f1f86d8f9595d005abc72301b1e3
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 244cb59..1799f26 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -112,6 +112,10 @@
public float minCellHeight;
public float minCellWidth;
+ public float twoPanelPortraitMinCellHeightDps;
+ public float twoPanelPortraitMinCellWidthDps;
+ public float twoPanelLandscapeMinCellHeightDps;
+ public float twoPanelLandscapeMinCellWidthDps;
public float borderSpacing;
private SparseArray<TypedValue> mExtraAttrs;
@@ -274,6 +278,10 @@
minCellHeight = displayOption.minCellHeight;
minCellWidth = displayOption.minCellWidth;
+ twoPanelPortraitMinCellHeightDps = displayOption.twoPanelPortraitMinCellHeightDps;
+ twoPanelPortraitMinCellWidthDps = displayOption.twoPanelPortraitMinCellWidthDps;
+ twoPanelLandscapeMinCellHeightDps = displayOption.twoPanelLandscapeMinCellHeightDps;
+ twoPanelLandscapeMinCellWidthDps = displayOption.twoPanelLandscapeMinCellWidthDps;
borderSpacing = displayOption.borderSpacing;
numShownHotseatIcons = closestProfile.numHotseatIcons;
@@ -707,6 +715,10 @@
private float minCellHeight;
private float minCellWidth;
+ private float twoPanelPortraitMinCellHeightDps;
+ private float twoPanelPortraitMinCellWidthDps;
+ private float twoPanelLandscapeMinCellHeightDps;
+ private float twoPanelLandscapeMinCellWidthDps;
private float borderSpacing;
private final float[] iconSizes = new float[COUNT_TOTAL];
@@ -726,6 +738,17 @@
minCellHeight = a.getFloat(R.styleable.ProfileDisplayOption_minCellHeightDps, 0);
minCellWidth = a.getFloat(R.styleable.ProfileDisplayOption_minCellWidthDps, 0);
+ twoPanelPortraitMinCellHeightDps = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelPortraitMinCellHeightDps,
+ minCellHeight);
+ twoPanelPortraitMinCellWidthDps = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelPortraitMinCellWidthDps, minCellWidth);
+ twoPanelLandscapeMinCellHeightDps = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelLandscapeMinCellHeightDps,
+ twoPanelPortraitMinCellHeightDps);
+ twoPanelLandscapeMinCellWidthDps = a.getFloat(
+ R.styleable.ProfileDisplayOption_twoPanelLandscapeMinCellWidthDps,
+ twoPanelPortraitMinCellWidthDps);
borderSpacing = a.getFloat(R.styleable.ProfileDisplayOption_borderSpacingDps, 0);
iconSizes[INDEX_DEFAULT] =
@@ -782,6 +805,10 @@
}
minCellHeight *= w;
minCellWidth *= w;
+ twoPanelPortraitMinCellHeightDps *= w;
+ twoPanelPortraitMinCellWidthDps *= w;
+ twoPanelLandscapeMinCellHeightDps *= w;
+ twoPanelLandscapeMinCellWidthDps *= w;
borderSpacing *= w;
return this;
}
@@ -793,6 +820,10 @@
}
minCellHeight += p.minCellHeight;
minCellWidth += p.minCellWidth;
+ twoPanelPortraitMinCellHeightDps += p.twoPanelPortraitMinCellHeightDps;
+ twoPanelPortraitMinCellWidthDps += p.twoPanelPortraitMinCellWidthDps;
+ twoPanelLandscapeMinCellHeightDps += p.twoPanelLandscapeMinCellHeightDps;
+ twoPanelLandscapeMinCellWidthDps += p.twoPanelLandscapeMinCellWidthDps;
borderSpacing += p.borderSpacing;
return this;
}