Use new icon stepping logic for Folders

Bug: 307694237
Test: DeviceProfileResponsiveDumpTest
Test: DeviceProfileResponsiveAlternativeDisplaysDumpTest
Test: ResponsiveFolderImageTest
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Change-Id: Ifbfb714e48c2e0851ef55ac60cadafbb6358d074
This commit is contained in:
Thales Lima
2023-11-04 17:10:13 +00:00
parent c543b46070
commit e9b5e14a2b
+8 -19
View File
@@ -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);