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
This commit is contained in:
Thales Lima
2021-09-03 18:37:19 +01:00
parent fbd591b211
commit d1df5fcaac
6 changed files with 95 additions and 24 deletions

View File

@@ -112,6 +112,10 @@ public class InvariantDeviceProfile {
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 @@ public class InvariantDeviceProfile {
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 @@ public class InvariantDeviceProfile {
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 @@ public class InvariantDeviceProfile {
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 @@ public class InvariantDeviceProfile {
}
minCellHeight *= w;
minCellWidth *= w;
twoPanelPortraitMinCellHeightDps *= w;
twoPanelPortraitMinCellWidthDps *= w;
twoPanelLandscapeMinCellHeightDps *= w;
twoPanelLandscapeMinCellWidthDps *= w;
borderSpacing *= w;
return this;
}
@@ -793,6 +820,10 @@ public class InvariantDeviceProfile {
}
minCellHeight += p.minCellHeight;
minCellWidth += p.minCellWidth;
twoPanelPortraitMinCellHeightDps += p.twoPanelPortraitMinCellHeightDps;
twoPanelPortraitMinCellWidthDps += p.twoPanelPortraitMinCellWidthDps;
twoPanelLandscapeMinCellHeightDps += p.twoPanelLandscapeMinCellHeightDps;
twoPanelLandscapeMinCellWidthDps += p.twoPanelLandscapeMinCellWidthDps;
borderSpacing += p.borderSpacing;
return this;
}