Use DeviceProfile numFolderRows and numFolderColumns
Invariant hold values that are not related to current DP in use. This is a change needed for IDP to hold more values in the future akin to iconSize. Bug: 309800141 Change-Id: Iefb388a5f6590d7da3452d2c388c02bd5e9d32bb Flag: N/A Test: NexusLauncherTests
This commit is contained in:
1 parent
ef8df12ff8
commit
07c6b8d96d
20 files changed
+67
-47
No files matched your search
@@ -176,6 +176,8 @@ public class DeviceProfile {
|
||||
public int cellYPaddingPx = -1;
|
||||
|
||||
// Folder
|
||||
public final int numFolderRows;
|
||||
public final int numFolderColumns;
|
||||
public float folderLabelTextScale;
|
||||
public int folderLabelTextSizePx;
|
||||
public int folderFooterHeightPx;
|
||||
@@ -431,6 +433,8 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale);
|
||||
numFolderRows = inv.numFolderRows;
|
||||
numFolderColumns = inv.numFolderColumns;
|
||||
|
||||
if (mIsScalableGrid && inv.folderStyle != INVALID_RESOURCE_HANDLE) {
|
||||
TypedArray folderStyle = context.obtainStyledAttributes(inv.folderStyle,
|
||||
@@ -622,11 +626,11 @@ public class DeviceProfile {
|
||||
isTwoPanels ? inv.folderSpecsTwoPanelId : inv.folderSpecsId),
|
||||
ResponsiveSpecType.Folder);
|
||||
mResponsiveFolderWidthSpec = folderSpecs.getCalculatedSpec(responsiveAspectRatio,
|
||||
DimensionType.WIDTH, inv.numFolderColumns,
|
||||
DimensionType.WIDTH, numFolderColumns,
|
||||
mResponsiveWorkspaceWidthSpec.getAvailableSpace(),
|
||||
mResponsiveWorkspaceWidthSpec);
|
||||
mResponsiveFolderHeightSpec = folderSpecs.getCalculatedSpec(responsiveAspectRatio,
|
||||
DimensionType.HEIGHT, inv.numFolderRows,
|
||||
DimensionType.HEIGHT, numFolderRows,
|
||||
mResponsiveWorkspaceHeightSpec.getAvailableSpace(),
|
||||
mResponsiveWorkspaceHeightSpec);
|
||||
}
|
||||
@@ -1365,16 +1369,16 @@ public class DeviceProfile {
|
||||
Point totalWorkspacePadding = getTotalWorkspacePadding();
|
||||
|
||||
// Check if the folder fit within the available height.
|
||||
float contentUsedHeight = folderCellHeightPx * inv.numFolderRows
|
||||
+ ((inv.numFolderRows - 1) * folderCellLayoutBorderSpacePx.y)
|
||||
float contentUsedHeight = folderCellHeightPx * numFolderRows
|
||||
+ ((numFolderRows - 1) * folderCellLayoutBorderSpacePx.y)
|
||||
+ folderFooterHeightPx
|
||||
+ folderContentPaddingTop;
|
||||
int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y;
|
||||
float scaleY = contentMaxHeight / contentUsedHeight;
|
||||
|
||||
// Check if the folder fit within the available width.
|
||||
float contentUsedWidth = folderCellWidthPx * inv.numFolderColumns
|
||||
+ ((inv.numFolderColumns - 1) * folderCellLayoutBorderSpacePx.x)
|
||||
float contentUsedWidth = folderCellWidthPx * numFolderColumns
|
||||
+ ((numFolderColumns - 1) * folderCellLayoutBorderSpacePx.x)
|
||||
+ folderContentPaddingLeftRight * 2;
|
||||
int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x;
|
||||
float scaleX = contentMaxWidth / contentUsedWidth;
|
||||
@@ -1991,8 +1995,8 @@ public class DeviceProfile {
|
||||
writer.println(prefix + pxToDpStr("iconTextSizePx", iconTextSizePx));
|
||||
writer.println(prefix + pxToDpStr("iconDrawablePaddingPx", iconDrawablePaddingPx));
|
||||
|
||||
writer.println(prefix + "\tinv.numFolderRows: " + inv.numFolderRows);
|
||||
writer.println(prefix + "\tinv.numFolderColumns: " + inv.numFolderColumns);
|
||||
writer.println(prefix + "\tnumFolderRows: " + numFolderRows);
|
||||
writer.println(prefix + "\tnumFolderColumns: " + numFolderColumns);
|
||||
writer.println(prefix + pxToDpStr("folderCellWidthPx", folderCellWidthPx));
|
||||
writer.println(prefix + pxToDpStr("folderCellHeightPx", folderCellHeightPx));
|
||||
writer.println(prefix + pxToDpStr("folderChildIconSizePx", folderChildIconSizePx));
|
||||
|
||||
Reference in new issue
Block a user