Create attr for padding between icon and text in cells
Bug: 265210314
Test: DeviceProfileDumpTest
Change-Id: I00af790d0c21c35f1cbce1362e63d3ab8259244a
Merged-In: I00af790d0c21c35f1cbce1362e63d3ab8259244a
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 8391b91..9f9c6f9 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -376,19 +376,19 @@
if (inv.folderStyle != INVALID_RESOURCE_HANDLE) {
TypedArray folderStyle = context.obtainStyledAttributes(inv.folderStyle,
- R.styleable.FolderDisplayStyle);
+ R.styleable.FolderStyle);
// These are re-set in #updateFolderCellSize if the grid is not scalable
folderCellHeightPx = folderStyle.getDimensionPixelSize(
- R.styleable.FolderDisplayStyle_folderCellHeight, 0);
+ R.styleable.FolderStyle_folderCellHeight, 0);
folderCellWidthPx = folderStyle.getDimensionPixelSize(
- R.styleable.FolderDisplayStyle_folderCellWidth, 0);
+ R.styleable.FolderStyle_folderCellWidth, 0);
folderContentPaddingTop = folderStyle.getDimensionPixelSize(
- R.styleable.FolderDisplayStyle_folderTopPadding, 0);
+ R.styleable.FolderStyle_folderTopPadding, 0);
folderCellLayoutBorderSpacePx = folderStyle.getDimensionPixelSize(
- R.styleable.FolderDisplayStyle_folderBorderSpace, 0);
+ R.styleable.FolderStyle_folderBorderSpace, 0);
folderFooterHeightPx = folderStyle.getDimensionPixelSize(
- R.styleable.FolderDisplayStyle_folderFooterHeight, 0);
+ R.styleable.FolderStyle_folderFooterHeight, 0);
folderStyle.recycle();
} else {
folderCellLayoutBorderSpacePx = 0;
@@ -407,8 +407,17 @@
mWorkspacePageIndicatorOverlapWorkspace =
res.getDimensionPixelSize(R.dimen.workspace_page_indicator_overlap_workspace);
- iconDrawablePaddingOriginalPx =
- res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);
+ TypedArray cellStyle;
+ if (inv.cellStyle != INVALID_RESOURCE_HANDLE) {
+ cellStyle = context.obtainStyledAttributes(inv.cellStyle,
+ R.styleable.CellStyle);
+ } else {
+ cellStyle = context.obtainStyledAttributes(R.style.CellStyleDefault,
+ R.styleable.CellStyle);
+ }
+ iconDrawablePaddingOriginalPx = cellStyle.getDimensionPixelSize(
+ R.styleable.CellStyle_iconDrawablePadding, 0);
+ cellStyle.recycle();
dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);
dropTargetBarTopMarginPx = res.getDimensionPixelSize(R.dimen.drop_target_top_margin);
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index ffe81ad..d97eac9 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -143,6 +143,8 @@
public @StyleRes int folderStyle;
+ public @StyleRes int cellStyle;
+
public float[] horizontalMargin;
public PointF[] allAppsCellSize;
@@ -349,6 +351,8 @@
numFolderColumns = closestProfile.numFolderColumns;
folderStyle = closestProfile.folderStyle;
+ cellStyle = closestProfile.cellStyle;
+
isScalable = closestProfile.isScalable;
devicePaddingId = closestProfile.devicePaddingId;
this.deviceType = deviceType;
@@ -783,6 +787,7 @@
private final int numFolderRows;
private final int numFolderColumns;
private final @StyleRes int folderStyle;
+ private final @StyleRes int cellStyle;
private final int numAllAppsColumns;
private final int numDatabaseAllAppsColumns;
@@ -852,6 +857,9 @@
folderStyle = a.getResourceId(R.styleable.GridDisplayOption_folderStyle,
INVALID_RESOURCE_HANDLE);
+ cellStyle = a.getResourceId(R.styleable.GridDisplayOption_cellStyle,
+ R.style.CellStyleDefault);
+
isScalable = a.getBoolean(
R.styleable.GridDisplayOption_isScalable, false);
devicePaddingId = a.getResourceId(