mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Merge "Folder cell should match grid cell aspect ratio if isScalableGrid is true." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f072b062a2
@@ -123,6 +123,7 @@ public class DeviceProfile {
|
||||
public int folderIconOffsetYPx;
|
||||
|
||||
// Folder content
|
||||
public int folderCellLayoutBorderSpacingPx;
|
||||
public int folderContentPaddingLeftRight;
|
||||
public int folderContentPaddingTop;
|
||||
|
||||
@@ -254,6 +255,7 @@ public class DeviceProfile {
|
||||
|
||||
setCellLayoutBorderSpacing(pxFromDp(inv.borderSpacing, mInfo.metrics, 1f));
|
||||
cellLayoutBorderSpacingOriginalPx = cellLayoutBorderSpacingPx;
|
||||
folderCellLayoutBorderSpacingPx = cellLayoutBorderSpacingPx;
|
||||
|
||||
int cellLayoutPaddingLeftRightMultiplier = !isVerticalBarLayout() && isTablet
|
||||
? PORTRAIT_TABLET_LEFT_RIGHT_PADDING_MULTIPLIER : 1;
|
||||
@@ -352,13 +354,7 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
private void setCellLayoutBorderSpacing(int borderSpacing) {
|
||||
if (isScalableGrid) {
|
||||
cellLayoutBorderSpacingPx = borderSpacing;
|
||||
folderContentPaddingLeftRight = borderSpacing;
|
||||
folderContentPaddingTop = borderSpacing;
|
||||
} else {
|
||||
cellLayoutBorderSpacingPx = 0;
|
||||
}
|
||||
cellLayoutBorderSpacingPx = isScalableGrid ? borderSpacing : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -587,14 +583,14 @@ public class DeviceProfile {
|
||||
|
||||
// Check if the icons fit within the available height.
|
||||
float contentUsedHeight = folderCellHeightPx * inv.numFolderRows
|
||||
+ ((inv.numFolderRows - 1) * cellLayoutBorderSpacingPx);
|
||||
+ ((inv.numFolderRows - 1) * folderCellLayoutBorderSpacingPx);
|
||||
int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y - folderBottomPanelSize
|
||||
- folderMargin - folderContentPaddingTop;
|
||||
float scaleY = contentMaxHeight / contentUsedHeight;
|
||||
|
||||
// Check if the icons fit within the available width.
|
||||
float contentUsedWidth = folderCellWidthPx * inv.numFolderColumns
|
||||
+ ((inv.numFolderColumns - 1) * cellLayoutBorderSpacingPx);
|
||||
+ ((inv.numFolderColumns - 1) * folderCellLayoutBorderSpacingPx);
|
||||
int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x - folderMargin
|
||||
- folderContentPaddingLeftRight * 2;
|
||||
float scaleX = contentMaxWidth / contentUsedWidth;
|
||||
@@ -612,11 +608,25 @@ public class DeviceProfile {
|
||||
folderLabelTextSizePx = (int) (folderChildTextSizePx * folderLabelTextScale);
|
||||
|
||||
int textHeight = Utilities.calculateTextHeight(folderChildTextSizePx);
|
||||
int cellPaddingX = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_x_padding) * scale);
|
||||
int cellPaddingY = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_y_padding) * scale);
|
||||
|
||||
folderCellWidthPx = folderChildIconSizePx + 2 * cellPaddingX;
|
||||
folderCellHeightPx = folderChildIconSizePx + 2 * cellPaddingY + textHeight;
|
||||
if (isScalableGrid) {
|
||||
folderCellWidthPx = (int) (cellWidthPx * scale);
|
||||
folderCellHeightPx = (int) (cellHeightPx * scale);
|
||||
|
||||
int borderSpacing = (int) (cellLayoutBorderSpacingOriginalPx * scale);
|
||||
folderCellLayoutBorderSpacingPx = borderSpacing;
|
||||
folderContentPaddingLeftRight = borderSpacing;
|
||||
folderContentPaddingTop = borderSpacing;
|
||||
} else {
|
||||
int cellPaddingX = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_x_padding)
|
||||
* scale);
|
||||
int cellPaddingY = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_y_padding)
|
||||
* scale);
|
||||
|
||||
folderCellWidthPx = folderChildIconSizePx + 2 * cellPaddingX;
|
||||
folderCellHeightPx = folderChildIconSizePx + 2 * cellPaddingY + textHeight;
|
||||
}
|
||||
|
||||
folderChildDrawablePaddingPx = Math.max(0,
|
||||
(folderCellHeightPx - folderChildIconSizePx - textHeight) / 3);
|
||||
}
|
||||
@@ -868,6 +878,8 @@ public class DeviceProfile {
|
||||
writer.println(prefix + pxToDpStr("folderChildTextSizePx", folderChildTextSizePx));
|
||||
writer.println(prefix + pxToDpStr("folderChildDrawablePaddingPx",
|
||||
folderChildDrawablePaddingPx));
|
||||
writer.println(prefix + pxToDpStr("folderCellLayoutBorderSpacingPx",
|
||||
folderCellLayoutBorderSpacingPx));
|
||||
|
||||
writer.println(prefix + pxToDpStr("cellLayoutBorderSpacingPx",
|
||||
cellLayoutBorderSpacingPx));
|
||||
|
||||
Reference in New Issue
Block a user