launcher: create attrs for more horizontal margin options

According to new specs, margins are different depending on orientation
and fold/unfolded. Also change the name of the variable to
horizontalMargin, since it applies the same padding to both sides.

Bug: 191879424
Test: manual and checking paddings in HSV
Change-Id: I8990c02b928a22b9f3b0cf3cbc3abf08df4daa9d
This commit is contained in:
Thales Lima
2021-09-21 17:18:47 +01:00
parent f8182da6c5
commit d90faab655
5 changed files with 68 additions and 20 deletions

View File

@@ -118,6 +118,9 @@ public class InvariantDeviceProfile {
public float twoPanelLandscapeMinCellHeightDps;
public float twoPanelLandscapeMinCellWidthDps;
public float borderSpacing;
public float horizontalMargin;
public float twoPanelLandscapeHorizontalMargin;
public float twoPanelPortraitHorizontalMargin;
private SparseArray<TypedValue> mExtraAttrs;
@@ -289,6 +292,10 @@ public class InvariantDeviceProfile {
borderSpacing = displayOption.borderSpacing;
allAppsCellSpacing = displayOption.allAppsCellSpacing;
horizontalMargin = displayOption.horizontalMargin;
twoPanelLandscapeHorizontalMargin = displayOption.twoPanelLandscapeHorizontalMargin;
twoPanelPortraitHorizontalMargin = displayOption.twoPanelPortraitHorizontalMargin;
numShownHotseatIcons = closestProfile.numHotseatIcons;
numDatabaseHotseatIcons = isSplitDisplay
? closestProfile.numDatabaseHotseatIcons : closestProfile.numHotseatIcons;
@@ -728,6 +735,10 @@ public class InvariantDeviceProfile {
private float allAppsCellSpacing;
private float borderSpacing;
private float horizontalMargin;
private float twoPanelLandscapeHorizontalMargin;
private float twoPanelPortraitHorizontalMargin;
private final float[] iconSizes = new float[COUNT_TOTAL];
private final float[] textSizes = new float[COUNT_TOTAL];
@@ -790,6 +801,14 @@ public class InvariantDeviceProfile {
a.getFloat(R.styleable.ProfileDisplayOption_twoPanelLandscapeIconTextSize,
textSizes[INDEX_LANDSCAPE]);
horizontalMargin = a.getFloat(R.styleable.ProfileDisplayOption_horizontalMargin, 0);
twoPanelLandscapeHorizontalMargin = a.getFloat(
R.styleable.ProfileDisplayOption_twoPanelLandscapeHorizontalMargin,
horizontalMargin);
twoPanelPortraitHorizontalMargin = a.getFloat(
R.styleable.ProfileDisplayOption_twoPanelPortraitHorizontalMargin,
horizontalMargin);
a.recycle();
}
@@ -820,6 +839,9 @@ public class InvariantDeviceProfile {
twoPanelLandscapeMinCellWidthDps *= w;
borderSpacing *= w;
allAppsCellSpacing *= w;
horizontalMargin *= w;
twoPanelLandscapeHorizontalMargin *= w;
twoPanelPortraitHorizontalMargin *= w;
return this;
}
@@ -836,6 +858,9 @@ public class InvariantDeviceProfile {
twoPanelLandscapeMinCellWidthDps += p.twoPanelLandscapeMinCellWidthDps;
borderSpacing += p.borderSpacing;
allAppsCellSpacing += p.allAppsCellSpacing;
horizontalMargin += p.horizontalMargin;
twoPanelLandscapeHorizontalMargin += p.twoPanelLandscapeHorizontalMargin;
twoPanelPortraitHorizontalMargin += p.twoPanelPortraitHorizontalMargin;
return this;
}
}