Fix issue where allAppsCellWidth is 0
when using secondary display on non-scalable grids causing allApps to be squished.
Bug: 234748862
Test: Manual
Change-Id: I2e92bce69438a17eccb0e4b2b2e3f2bdbfa7600e
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 13f20c2..165ec5e 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -252,9 +252,10 @@
if not specified -->
<attr name="borderSpaceTwoPanelLandscapeVertical" format="float" />
- <!-- These min cell values are only used if GridDisplayOption#isScalable is true -->
- <!-- defaults to minCellHeight, if not specified -->
+ <!-- defaults to minCellHeight if not specified when GridDisplayOption#isScalable is true.
+ Must be defined when GridDisplayOption#isScalable is false. -->
<attr name="allAppsCellHeight" format="float" />
+ <!-- These min cell values are only used if GridDisplayOption#isScalable is true -->
<!-- defaults to minCellWidth, if not specified -->
<attr name="allAppsCellWidth" format="float" />
<!-- defaults to allAppsCellHeight, if not specified -->
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index a428b7e..87885f6 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -799,13 +799,13 @@
+ allAppsBorderSpacePx.y;
// but width is just the cell,
// the border is added in #updateAllAppsContainerWidth
- allAppsCellWidthPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].x, mMetrics, scale);
if (isScalableGrid) {
allAppsIconSizePx =
pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics, scale);
allAppsIconTextSizePx =
pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics, scale);
allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
+ allAppsCellWidthPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].x, mMetrics, scale);
} else {
float invIconSizeDp = inv.allAppsIconSize[mTypeIndex];
float invIconTextSizeSp = inv.allAppsIconTextSize[mTypeIndex];
@@ -813,6 +813,7 @@
allAppsIconTextSizePx = (int) (pxFromSp(invIconTextSizeSp, mMetrics) * scale);
allAppsIconDrawablePaddingPx =
res.getDimensionPixelSize(R.dimen.all_apps_icon_drawable_padding);
+ allAppsCellWidthPx = allAppsIconSizePx + (2 * allAppsIconDrawablePaddingPx);
}
updateAllAppsContainerWidth(res);