diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 73cd8c42f2..23b1a00740 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -1338,8 +1338,6 @@ public class DeviceProfile { if (mIsResponsiveGrid) { folderCellWidthPx = mResponsiveFolderWidthSpec.getCellSizePx(); - - // Height folderCellHeightPx = mResponsiveFolderHeightSpec.getCellSizePx(); folderContentPaddingTop = mResponsiveFolderHeightSpec.getStartPaddingPx(); folderFooterHeightPx = mResponsiveFolderHeightSpec.getEndPaddingPx(); @@ -1356,24 +1354,15 @@ public class DeviceProfile { // Recalculating padding and cell height folderChildDrawablePaddingPx = getNormalizedFolderChildDrawablePaddingPx(textHeight); - int folderCellContentHeight = folderChildIconSizePx + folderChildDrawablePaddingPx - + textHeight; - // Reduce the icon in height when it's taller than the expected cell height - while (folderChildIconSizePx > mIconSizeSteps.minimumIconSize() - && folderCellContentHeight > folderCellHeightPx) { - folderChildDrawablePaddingPx -= folderCellContentHeight - folderCellHeightPx; - if (folderChildDrawablePaddingPx < 0) { - // get a smaller icon size - folderChildIconSizePx = mIconSizeSteps.getNextLowerIconSize( - folderChildIconSizePx); - folderChildDrawablePaddingPx = - getNormalizedFolderChildDrawablePaddingPx(textHeight); - } - // calculate new cellContentHeight - folderCellContentHeight = folderChildIconSizePx + folderChildDrawablePaddingPx - + textHeight; - } + CellContentDimensions cellContentDimensions = new CellContentDimensions( + folderChildIconSizePx, + folderChildDrawablePaddingPx, + folderChildTextSizePx); + cellContentDimensions.resizeToFitCellHeight(folderCellHeightPx, mIconSizeSteps); + folderChildIconSizePx = cellContentDimensions.getIconSizePx(); + folderChildDrawablePaddingPx = cellContentDimensions.getIconDrawablePaddingPx(); + folderChildTextSizePx = cellContentDimensions.getIconTextSizePx(); } else if (mIsScalableGrid) { if (inv.folderStyle == INVALID_RESOURCE_HANDLE) { folderCellWidthPx = roundPxValueFromFloat(getCellSize().x * scale);