fix(grid): apply the icon size setting on responsive grids (#7407)
Home screen > Icon size (homeIconSizeFactor) had no effect on responsive grids such as "practical": DeviceProfileOverrides scales the IDP's iconSize, but responsive grids take their icon size from their cell specs (mResponsiveWorkspaceCellSpec.getIconSize()) and never read inv.iconSize. getResponsiveIconSizePx() now applies the factor to the cell specs' icon size, for the workspace, the hotseat and folder content, the same three places the IDP-sized grids use inv.iconSize. The responsive code still shrinks an icon that doesn't fit its cell (getIconSmallerThan). The icon bitmap size already followed the factor, as the IDP computes it from the scaled iconSize. Visible change: on responsive grids the setting now works; at 100% (the default) nothing changes. (cherry picked from commit 6345b71df7dbd77be6c4da03ddcc76ebcadd2e90) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
5c1979227e
commit
59b60098b2
1 file changed
+13
-3
@@ -601,7 +601,7 @@ public class DeviceProfile {
|
||||
mHotseatQsbSpaceBase = hotseatQsbSpace;
|
||||
|
||||
if (mIsResponsiveGrid) {
|
||||
updateHotseatSizes(mResponsiveWorkspaceCellSpec.getIconSize());
|
||||
updateHotseatSizes(getResponsiveIconSizePx());
|
||||
} else {
|
||||
updateHotseatSizes(pxFromDp(inv.iconSize[mTypeIndex], mMetrics));
|
||||
}
|
||||
@@ -1138,7 +1138,7 @@ public class DeviceProfile {
|
||||
iconCenterVertically = (mIsScalableGrid || mIsResponsiveGrid) && isVerticalBarLayout();
|
||||
|
||||
if (mIsResponsiveGrid) {
|
||||
iconSizePx = mResponsiveWorkspaceCellSpec.getIconSize();
|
||||
iconSizePx = getResponsiveIconSizePx();
|
||||
iconTextSizePx = mResponsiveWorkspaceCellSpec.getIconTextSize();
|
||||
mIconDrawablePaddingOriginalPx = mResponsiveWorkspaceCellSpec.getIconDrawablePadding();
|
||||
maxIconTextLineCount = mResponsiveWorkspaceCellSpec.getIconTextMaxLineCount();
|
||||
@@ -1183,6 +1183,16 @@ public class DeviceProfile {
|
||||
return Math.round(extraHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* LC-Note: the responsive cell specs' icon size, scaled by Home screen > Icon size like the
|
||||
* grids sized from the IDP (whose iconSize DeviceProfileOverrides scales). The specs never see
|
||||
* that setting otherwise.
|
||||
*/
|
||||
private int getResponsiveIconSizePx() {
|
||||
return Math.max(1, Math.round(mResponsiveWorkspaceCellSpec.getIconSize()
|
||||
* PreferenceCacheExtensionsKt.firstCached(preferenceManager2.getHomeIconSizeFactor())));
|
||||
}
|
||||
|
||||
private int getCellLayoutHeightSpecification() {
|
||||
return (cellHeightPx * inv.numRows) + (cellLayoutBorderSpacePx.y * (inv.numRows - 1))
|
||||
+ cellLayoutPaddingPx.top + cellLayoutPaddingPx.bottom;
|
||||
@@ -1507,7 +1517,7 @@ public class DeviceProfile {
|
||||
private void updateFolderCellSize(float scale, Resources res) {
|
||||
int minLabelTextSize = pxFromSp(MIN_FOLDER_TEXT_SIZE_SP, mMetrics, scale);
|
||||
if (mIsResponsiveGrid) {
|
||||
folderChildIconSizePx = mResponsiveWorkspaceCellSpec.getIconSize();
|
||||
folderChildIconSizePx = getResponsiveIconSizePx();
|
||||
folderChildTextSizePx = mResponsiveWorkspaceCellSpec.getIconTextSize();
|
||||
folderLabelTextSizePx = Math.max(minLabelTextSize,
|
||||
(int) (folderChildTextSizePx * folderLabelTextScale));
|
||||
|
||||
Reference in new issue
Block a user