rename display-option attributes
Rename the attributes to make it more standardized and to be easier to check the multiple variants.
Bug: 202708085
Test: compile and run different launchers
Change-Id: I18b981877b9160bd3801a02567d52b49747d50d4
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 08570eb..4d14cb2 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -182,76 +182,76 @@
<attr name="minHeightDps" format="float" />
<!-- These min cell values are only used if GridDisplayOption#isScalable is true -->
- <attr name="minCellHeightDps" format="float" />
- <attr name="minCellWidthDps" format="float" />
- <!-- twoPanelPortraitMinCellWidthDps defaults to minCellHeightDps, if not specified -->
- <attr name="twoPanelPortraitMinCellHeightDps" format="float" />
- <!-- twoPanelPortraitMinCellHeightDps defaults to minCellWidthDps, if not specified -->
- <attr name="twoPanelPortraitMinCellWidthDps" format="float" />
- <!-- twoPanelLandscapeMinCellHeightDps defaults to minCellHeightDps, if not specified -->
- <attr name="twoPanelLandscapeMinCellHeightDps" format="float" />
- <!-- twoPanelLandscapeMinCellWidthDps defaults to minCellWidthDps, if not specified -->
- <attr name="twoPanelLandscapeMinCellWidthDps" format="float" />
+ <attr name="minCellHeight" format="float" />
+ <attr name="minCellWidth" format="float" />
+ <!-- defaults to minCellHeight, if not specified -->
+ <attr name="minCellHeightTwoPanelPortrait" format="float" />
+ <!-- defaults to minCellWidth, if not specified -->
+ <attr name="minCellWidthTwoPanelPortrait" format="float" />
+ <!-- defaults to minCellHeight, if not specified -->
+ <attr name="minCellHeightTwoPanelLandscape" format="float" />
+ <!-- defaults to minCellWidth, if not specified -->
+ <attr name="minCellWidthTwoPanelLandscape" format="float" />
<!-- These border spaces are only used if GridDisplayOption#isScalable is true -->
<!-- space to be used horizontally and vertically -->
- <attr name="borderSpaceDps" format="float" />
- <!-- space to the right of the cell, defaults to borderSpaceDps if not specified -->
- <attr name="borderSpaceHorizontalDps" format="float" />
- <!-- space below the cell, defaults to borderSpaceDps if not specified -->
- <attr name="borderSpaceVerticalDps" format="float" />
+ <attr name="borderSpace" format="float" />
+ <!-- space to the right of the cell, defaults to borderSpace if not specified -->
+ <attr name="borderSpaceHorizontal" format="float" />
+ <!-- space below the cell, defaults to borderSpace if not specified -->
+ <attr name="borderSpaceVertical" format="float" />
<!-- space to be used horizontally and vertically in two panels,
- defaults to borderSpaceDps if not specified -->
- <attr name="twoPanelPortraitBorderSpaceDps" format="float" />
+ defaults to borderSpace if not specified -->
+ <attr name="borderSpaceTwoPanelPortrait" format="float" />
<!-- space to the right of the cell in two panels, defaults to
- twoPanelPortraitBorderSpaceDps if not specified -->
- <attr name="twoPanelPortraitBorderSpaceHorizontalDps" format="float" />
- <!-- space below the cell in two panels, defaults to twoPanelPortraitBorderSpaceDps
+ borderSpaceTwoPanelPortrait if not specified -->
+ <attr name="borderSpaceTwoPanelPortraitHorizontal" format="float" />
+ <!-- space below the cell in two panels, defaults to borderSpaceTwoPanelPortrait
if not specified -->
- <attr name="twoPanelPortraitBorderSpaceVerticalDps" format="float" />
+ <attr name="borderSpaceTwoPanelPortraitVertical" format="float" />
<!-- space to be used horizontally and vertically in two panels,
- defaults to borderSpaceDps if not specified -->
- <attr name="twoPanelLandscapeBorderSpaceDps" format="float" />
+ defaults to borderSpace if not specified -->
+ <attr name="borderSpaceTwoPanelLandscape" format="float" />
<!-- space to the right of the cell in two panels, defaults to
- twoPanelLandscapeBorderSpaceDps if not specified -->
- <attr name="twoPanelLandscapeBorderSpaceHorizontalDps" format="float" />
- <!-- space below the cell in two panels, defaults to twoPanelLandscapeBorderSpaceDps
+ borderSpaceTwoPanelLandscape if not specified -->
+ <attr name="borderSpaceTwoPanelLandscapeHorizontal" format="float" />
+ <!-- space below the cell in two panels, defaults to borderSpaceTwoPanelLandscape
if not specified -->
- <attr name="twoPanelLandscapeBorderSpaceVerticalDps" format="float" />
+ <attr name="borderSpaceTwoPanelLandscapeVertical" format="float" />
- <!-- allAppsCellSpacingDps defaults to borderSpaceDps, if not specified -->
- <attr name="allAppsCellSpacingDps" format="float" />
+ <!-- defaults to borderSpace, if not specified -->
+ <attr name="allAppsBorderSpace" format="float" />
<!-- The following values are only enabled if grid is supported. -->
- <!-- allAppsIconSize defaults to iconSize, if not specified -->
+ <!-- defaults to iconImageSize, if not specified -->
<attr name="allAppsIconSize" format="float" />
- <!-- allAppsIconTextSize defaults to iconTextSize, if not specified -->
+ <!-- defaults to iconTextSize, if not specified -->
<attr name="allAppsIconTextSize" format="float" />
<attr name="iconImageSize" format="float" />
- <!-- landscapeIconSize defaults to iconImageSize, if not specified -->
- <attr name="landscapeIconSize" format="float" />
- <!-- twoPanelPortraitIconSize defaults to iconImageSize, if not specified -->
- <attr name="twoPanelPortraitIconSize" format="float" />
- <!-- twoPanelLandscapeIconSize defaults to iconImageSize, if not specified -->
- <attr name="twoPanelLandscapeIconSize" format="float" />
+ <!-- defaults to iconImageSize, if not specified -->
+ <attr name="iconSizeLandscape" format="float" />
+ <!-- defaults to iconSize, if not specified -->
+ <attr name="iconSizeTwoPanelPortrait" format="float" />
+ <!-- defaults to iconSize, if not specified -->
+ <attr name="iconSizeTwoPanelLandscape" format="float" />
<attr name="iconTextSize" format="float" />
- <!-- landscapeIconTextSize defaults to iconTextSize, if not specified -->
- <attr name="landscapeIconTextSize" format="float" />
- <!-- twoPanelPortraitIconTextSize defaults to iconTextSize, if not specified -->
- <attr name="twoPanelPortraitIconTextSize" format="float" />
- <!-- twoPanelLandscapeIconTextSize defaults to iconTextSize, if not specified -->
- <attr name="twoPanelLandscapeIconTextSize" format="float" />
+ <!-- defaults to iconTextSize, if not specified -->
+ <attr name="iconTextSizeLandscape" format="float" />
+ <!-- defaults to iconTextSize, if not specified -->
+ <attr name="iconTextSizeTwoPanelPortrait" format="float" />
+ <!-- defaults to iconTextSize, if not specified -->
+ <attr name="iconTextSizeTwoPanelLandscape" format="float" />
<!-- If set, this display option is used to determine the default grid -->
<attr name="canBeDefault" format="boolean" />
<!-- Margin on left and right of the workspace when GridDisplayOption#isScalable is true -->
<attr name="horizontalMargin" format="float"/>
- <!-- twoPanelLandscapeHorizontalMargin defaults to horizontalMargin if not specified -->
- <attr name="twoPanelLandscapeHorizontalMargin" format="float"/>
- <!-- twoPanelPortraitHorizontalMargin defaults to horizontalMargin if not specified -->
- <attr name="twoPanelPortraitHorizontalMargin" format="float"/>
+ <!-- defaults to horizontalMargin if not specified -->
+ <attr name="horizontalMarginTwoPanelLandscape" format="float"/>
+ <!-- defaults to horizontalMargin if not specified -->
+ <attr name="horizontalMarginTwoPanelPortrait" format="float"/>
</declare-styleable>
<declare-styleable name="CellLayout">
diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml
index 08698e7..d2d8fc3 100644
--- a/res/xml/device_profiles.xml
+++ b/res/xml/device_profiles.xml
@@ -152,14 +152,14 @@
launcher:name="Tablet"
launcher:minWidthDps="900"
launcher:minHeightDps="820"
- launcher:minCellHeightDps="104"
- launcher:minCellWidthDps="80"
+ launcher:minCellHeight="104"
+ launcher:minCellWidth="80"
launcher:iconImageSize="60"
launcher:iconTextSize="14"
- launcher:borderSpaceDps="16"
+ launcher:borderSpace="16"
launcher:allAppsIconSize="60"
launcher:allAppsIconTextSize="14"
- launcher:allAppsCellSpacingDps="16"
+ launcher:allAppsBorderSpace="16"
launcher:canBeDefault="true" />
</grid-option>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 624afe1..4a7dbd8 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -166,7 +166,7 @@
public int qsbBottomMarginPx;
// All apps
- public Point allAppsCellSpacePx;
+ public Point allAppsBorderSpacePx;
public int allAppsOpenVerticalTranslate;
public int allAppsCellHeightPx;
public int allAppsCellWidthPx;
@@ -290,7 +290,7 @@
folderContentPaddingTop = res.getDimensionPixelSize(R.dimen.folder_content_padding_top);
cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv);
- allAppsCellSpacePx = new Point(
+ allAppsBorderSpacePx = new Point(
pxFromDp(inv.borderSpaces[InvariantDeviceProfile.INDEX_ALL_APPS].x, mMetrics, 1f),
pxFromDp(inv.borderSpaces[InvariantDeviceProfile.INDEX_ALL_APPS].y, mMetrics, 1f));
cellLayoutBorderSpaceOriginalPx = new Point(cellLayoutBorderSpacePx);
@@ -596,7 +596,7 @@
private void updateAllAppsWidth() {
if (isTwoPanels) {
int usedWidth = (allAppsCellWidthPx * numShownAllAppsColumns)
- + (allAppsCellSpacePx.x * (numShownAllAppsColumns + 1));
+ + (allAppsBorderSpacePx.x * (numShownAllAppsColumns + 1));
allAppsLeftRightPadding = Math.max(1, (availableWidthPx - usedWidth) / 2);
} else {
allAppsLeftRightPadding =
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index ff7a90c..41f050c 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -773,52 +773,52 @@
float x;
float y;
- x = a.getFloat(R.styleable.ProfileDisplayOption_minCellWidthDps, 0);
- y = a.getFloat(R.styleable.ProfileDisplayOption_minCellHeightDps, 0);
+ x = a.getFloat(R.styleable.ProfileDisplayOption_minCellWidth, 0);
+ y = a.getFloat(R.styleable.ProfileDisplayOption_minCellHeight, 0);
minCellSize[INDEX_DEFAULT] = new PointF(x, y);
minCellSize[INDEX_LANDSCAPE] = new PointF(x, y);
minCellSize[INDEX_ALL_APPS] = new PointF(x, y);
- x = a.getFloat(R.styleable.ProfileDisplayOption_twoPanelPortraitMinCellWidthDps,
+ x = a.getFloat(R.styleable.ProfileDisplayOption_minCellWidthTwoPanelPortrait,
minCellSize[INDEX_DEFAULT].x);
- y = a.getFloat(R.styleable.ProfileDisplayOption_twoPanelPortraitMinCellHeightDps,
+ y = a.getFloat(R.styleable.ProfileDisplayOption_minCellHeightTwoPanelPortrait,
minCellSize[INDEX_DEFAULT].y);
minCellSize[INDEX_TWO_PANEL_PORTRAIT] = new PointF(x, y);
- x = a.getFloat(R.styleable.ProfileDisplayOption_twoPanelLandscapeMinCellWidthDps,
+ x = a.getFloat(R.styleable.ProfileDisplayOption_minCellWidthTwoPanelLandscape,
minCellSize[INDEX_DEFAULT].x);
- y = a.getFloat(R.styleable.ProfileDisplayOption_twoPanelLandscapeMinCellHeightDps,
+ y = a.getFloat(R.styleable.ProfileDisplayOption_minCellHeightTwoPanelLandscape,
minCellSize[INDEX_DEFAULT].y);
minCellSize[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
- float borderSpace = a.getFloat(R.styleable.ProfileDisplayOption_borderSpaceDps, 0);
- float twoPanelPortraitBorderSpaceDps = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelPortraitBorderSpaceDps, borderSpace);
- float twoPanelLandscapeBorderSpaceDps = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelLandscapeBorderSpaceDps, borderSpace);
+ float borderSpace = a.getFloat(R.styleable.ProfileDisplayOption_borderSpace, 0);
+ float borderSpaceTwoPanelPortrait = a.getFloat(
+ R.styleable.ProfileDisplayOption_borderSpaceTwoPanelPortrait, borderSpace);
+ float borderSpaceTwoPanelLandscape = a.getFloat(
+ R.styleable.ProfileDisplayOption_borderSpaceTwoPanelLandscape, borderSpace);
- x = a.getFloat(R.styleable.ProfileDisplayOption_borderSpaceHorizontalDps, borderSpace);
- y = a.getFloat(R.styleable.ProfileDisplayOption_borderSpaceVerticalDps, borderSpace);
+ x = a.getFloat(R.styleable.ProfileDisplayOption_borderSpaceHorizontal, borderSpace);
+ y = a.getFloat(R.styleable.ProfileDisplayOption_borderSpaceVertical, borderSpace);
borderSpaces[INDEX_DEFAULT] = new PointF(x, y);
borderSpaces[INDEX_LANDSCAPE] = new PointF(x, y);
x = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelPortraitBorderSpaceHorizontalDps,
- twoPanelPortraitBorderSpaceDps);
+ R.styleable.ProfileDisplayOption_borderSpaceTwoPanelPortraitHorizontal,
+ borderSpaceTwoPanelPortrait);
y = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelPortraitBorderSpaceVerticalDps,
- twoPanelPortraitBorderSpaceDps);
+ R.styleable.ProfileDisplayOption_borderSpaceTwoPanelPortraitVertical,
+ borderSpaceTwoPanelPortrait);
borderSpaces[INDEX_TWO_PANEL_PORTRAIT] = new PointF(x, y);
x = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelLandscapeBorderSpaceHorizontalDps,
- twoPanelLandscapeBorderSpaceDps);
+ R.styleable.ProfileDisplayOption_borderSpaceTwoPanelLandscapeHorizontal,
+ borderSpaceTwoPanelLandscape);
y = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelLandscapeBorderSpaceVerticalDps,
- twoPanelLandscapeBorderSpaceDps);
+ R.styleable.ProfileDisplayOption_borderSpaceTwoPanelLandscapeVertical,
+ borderSpaceTwoPanelLandscape);
borderSpaces[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
- x = y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsCellSpacingDps,
+ x = y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpace,
borderSpace);
borderSpaces[INDEX_ALL_APPS] = new PointF(x, y);
folderBorderSpace = borderSpace;
@@ -826,31 +826,31 @@
iconSizes[INDEX_DEFAULT] =
a.getFloat(R.styleable.ProfileDisplayOption_iconImageSize, 0);
iconSizes[INDEX_LANDSCAPE] =
- a.getFloat(R.styleable.ProfileDisplayOption_landscapeIconSize,
+ a.getFloat(R.styleable.ProfileDisplayOption_iconSizeLandscape,
iconSizes[INDEX_DEFAULT]);
iconSizes[INDEX_ALL_APPS] =
a.getFloat(R.styleable.ProfileDisplayOption_allAppsIconSize,
iconSizes[INDEX_DEFAULT]);
iconSizes[INDEX_TWO_PANEL_PORTRAIT] =
- a.getFloat(R.styleable.ProfileDisplayOption_twoPanelPortraitIconSize,
+ a.getFloat(R.styleable.ProfileDisplayOption_iconSizeTwoPanelPortrait,
iconSizes[INDEX_DEFAULT]);
iconSizes[INDEX_TWO_PANEL_LANDSCAPE] =
- a.getFloat(R.styleable.ProfileDisplayOption_twoPanelLandscapeIconSize,
+ a.getFloat(R.styleable.ProfileDisplayOption_iconSizeTwoPanelLandscape,
iconSizes[INDEX_DEFAULT]);
textSizes[INDEX_DEFAULT] =
a.getFloat(R.styleable.ProfileDisplayOption_iconTextSize, 0);
textSizes[INDEX_LANDSCAPE] =
- a.getFloat(R.styleable.ProfileDisplayOption_landscapeIconTextSize,
+ a.getFloat(R.styleable.ProfileDisplayOption_iconTextSizeLandscape,
textSizes[INDEX_DEFAULT]);
textSizes[INDEX_ALL_APPS] =
a.getFloat(R.styleable.ProfileDisplayOption_allAppsIconTextSize,
textSizes[INDEX_DEFAULT]);
textSizes[INDEX_TWO_PANEL_PORTRAIT] =
- a.getFloat(R.styleable.ProfileDisplayOption_twoPanelPortraitIconTextSize,
+ a.getFloat(R.styleable.ProfileDisplayOption_iconTextSizeTwoPanelPortrait,
textSizes[INDEX_DEFAULT]);
textSizes[INDEX_TWO_PANEL_LANDSCAPE] =
- a.getFloat(R.styleable.ProfileDisplayOption_twoPanelLandscapeIconTextSize,
+ a.getFloat(R.styleable.ProfileDisplayOption_iconTextSizeTwoPanelLandscape,
textSizes[INDEX_DEFAULT]);
horizontalMargin[INDEX_DEFAULT] = a.getFloat(
@@ -858,10 +858,10 @@
horizontalMargin[INDEX_LANDSCAPE] = horizontalMargin[INDEX_DEFAULT];
horizontalMargin[INDEX_ALL_APPS] = horizontalMargin[INDEX_DEFAULT];
horizontalMargin[INDEX_TWO_PANEL_LANDSCAPE] = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelLandscapeHorizontalMargin,
+ R.styleable.ProfileDisplayOption_horizontalMarginTwoPanelLandscape,
horizontalMargin[INDEX_DEFAULT]);
horizontalMargin[INDEX_TWO_PANEL_PORTRAIT] = a.getFloat(
- R.styleable.ProfileDisplayOption_twoPanelPortraitHorizontalMargin,
+ R.styleable.ProfileDisplayOption_horizontalMarginTwoPanelPortrait,
horizontalMargin[INDEX_DEFAULT]);
a.recycle();