Loading res/values/attrs.xml +12 −0 Original line number Diff line number Diff line Loading @@ -164,7 +164,19 @@ <!-- numFolderRows & numFolderColumns defaults to numRows & numColumns, if not specified --> <attr name="numFolderRows" format="integer" /> <!-- defaults to numFolderRows, if not specified --> <attr name="numFolderRowsLandscape" format="integer" /> <!-- defaults to numFolderRows, if not specified --> <attr name="numFolderRowsTwoPanelLandscape" format="integer" /> <!-- defaults to numFolderRows, if not specified --> <attr name="numFolderRowsTwoPanelPortrait" format="integer" /> <attr name="numFolderColumns" format="integer" /> <!-- defaults to numFolderColumns, if not specified --> <attr name="numFolderColumnsLandscape" format="integer" /> <!-- defaults to numFolderColumns, if not specified --> <attr name="numFolderColumnsTwoPanelLandscape" format="integer" /> <!-- defaults to numFolderColumns, if not specified --> <attr name="numFolderColumnsTwoPanelPortrait" format="integer" /> <!-- Support attributes in FolderStyle --> <attr name="folderStyle" format="reference" /> Loading src/com/android/launcher3/DeviceProfile.java +12 −8 Original line number Diff line number Diff line Loading @@ -182,6 +182,8 @@ public class DeviceProfile { public int cellYPaddingPx = -1; // Folder public final int numFolderRows; public final int numFolderColumns; public final float folderLabelTextScale; public int folderLabelTextSizePx; public int folderFooterHeightPx; Loading Loading @@ -439,6 +441,8 @@ public class DeviceProfile { } folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale); numFolderRows = inv.numFolderRows[mTypeIndex]; numFolderColumns = inv.numFolderColumns[mTypeIndex]; if (mIsScalableGrid && inv.folderStyle != INVALID_RESOURCE_HANDLE) { TypedArray folderStyle = context.obtainStyledAttributes(inv.folderStyle, Loading Loading @@ -645,11 +649,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); Loading Loading @@ -1406,16 +1410,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; Loading Loading @@ -2045,8 +2049,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)); Loading src/com/android/launcher3/InvariantDeviceProfile.java +34 −6 Original line number Diff line number Diff line Loading @@ -122,8 +122,8 @@ public class InvariantDeviceProfile { /** * Number of icons per row and column in the folder. */ public int numFolderRows; public int numFolderColumns; public int[] numFolderRows; public int[] numFolderColumns; public float[] iconSize; public float[] iconTextSize; public int iconBitmapSize; Loading Loading @@ -810,8 +810,8 @@ public class InvariantDeviceProfile { public final int numSearchContainerColumns; public final int deviceCategory; private final int numFolderRows; private final int numFolderColumns; private final int[] numFolderRows = new int[COUNT_SIZES]; private final int[] numFolderColumns = new int[COUNT_SIZES]; private final @StyleRes int folderStyle; private final @StyleRes int cellStyle; Loading Loading @@ -888,11 +888,39 @@ public class InvariantDeviceProfile { a.getResourceId(R.styleable.GridDisplayOption_inlineNavButtonsEndSpacing, R.dimen.taskbar_button_margin_default); numFolderRows = a.getInt( numFolderRows[INDEX_DEFAULT] = a.getInt( R.styleable.GridDisplayOption_numFolderRows, numRows); numFolderColumns = a.getInt( numFolderColumns[INDEX_DEFAULT] = a.getInt( R.styleable.GridDisplayOption_numFolderColumns, numColumns); if (FeatureFlags.enableResponsiveWorkspace()) { numFolderRows[INDEX_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderRowsLandscape, numFolderRows[INDEX_DEFAULT]); numFolderColumns[INDEX_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderColumnsLandscape, numFolderColumns[INDEX_DEFAULT]); numFolderRows[INDEX_TWO_PANEL_PORTRAIT] = a.getInt( R.styleable.GridDisplayOption_numFolderRowsTwoPanelPortrait, numFolderRows[INDEX_DEFAULT]); numFolderColumns[INDEX_TWO_PANEL_PORTRAIT] = a.getInt( R.styleable.GridDisplayOption_numFolderColumnsTwoPanelPortrait, numFolderColumns[INDEX_DEFAULT]); numFolderRows[INDEX_TWO_PANEL_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderRowsTwoPanelLandscape, numFolderRows[INDEX_DEFAULT]); numFolderColumns[INDEX_TWO_PANEL_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderColumnsTwoPanelLandscape, numFolderColumns[INDEX_DEFAULT]); } else { numFolderRows[INDEX_LANDSCAPE] = numFolderRows[INDEX_DEFAULT]; numFolderColumns[INDEX_LANDSCAPE] = numFolderColumns[INDEX_DEFAULT]; numFolderRows[INDEX_TWO_PANEL_PORTRAIT] = numFolderRows[INDEX_DEFAULT]; numFolderColumns[INDEX_TWO_PANEL_PORTRAIT] = numFolderColumns[INDEX_DEFAULT]; numFolderRows[INDEX_TWO_PANEL_LANDSCAPE] = numFolderRows[INDEX_DEFAULT]; numFolderColumns[INDEX_TWO_PANEL_LANDSCAPE] = numFolderColumns[INDEX_DEFAULT]; } folderStyle = a.getResourceId(R.styleable.GridDisplayOption_folderStyle, INVALID_RESOURCE_HANDLE); Loading src/com/android/launcher3/Launcher.java +1 −1 Original line number Diff line number Diff line Loading @@ -791,7 +791,7 @@ public class Launcher extends StatefulActivity<LauncherState> if (info.container >= 0) { View folderIcon = getWorkspace().getHomescreenIconByItemId(info.container); if (folderIcon instanceof FolderIcon && folderIcon.getTag() instanceof FolderInfo) { if (new FolderGridOrganizer(getDeviceProfile().inv) if (new FolderGridOrganizer(getDeviceProfile()) .setFolderInfo((FolderInfo) folderIcon.getTag()) .isItemInPreview(info.rank)) { folderIcon.invalidate(); Loading src/com/android/launcher3/ModelCallbacks.kt +1 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { // Cache one page worth of icons launcher.viewCache.setCacheSize( R.layout.folder_application, deviceProfile.inv.numFolderColumns * deviceProfile.inv.numFolderRows deviceProfile.numFolderColumns * deviceProfile.numFolderRows ) launcher.viewCache.setCacheSize(R.layout.folder_page, 2) TraceHelper.INSTANCE.endSection() Loading Loading
res/values/attrs.xml +12 −0 Original line number Diff line number Diff line Loading @@ -164,7 +164,19 @@ <!-- numFolderRows & numFolderColumns defaults to numRows & numColumns, if not specified --> <attr name="numFolderRows" format="integer" /> <!-- defaults to numFolderRows, if not specified --> <attr name="numFolderRowsLandscape" format="integer" /> <!-- defaults to numFolderRows, if not specified --> <attr name="numFolderRowsTwoPanelLandscape" format="integer" /> <!-- defaults to numFolderRows, if not specified --> <attr name="numFolderRowsTwoPanelPortrait" format="integer" /> <attr name="numFolderColumns" format="integer" /> <!-- defaults to numFolderColumns, if not specified --> <attr name="numFolderColumnsLandscape" format="integer" /> <!-- defaults to numFolderColumns, if not specified --> <attr name="numFolderColumnsTwoPanelLandscape" format="integer" /> <!-- defaults to numFolderColumns, if not specified --> <attr name="numFolderColumnsTwoPanelPortrait" format="integer" /> <!-- Support attributes in FolderStyle --> <attr name="folderStyle" format="reference" /> Loading
src/com/android/launcher3/DeviceProfile.java +12 −8 Original line number Diff line number Diff line Loading @@ -182,6 +182,8 @@ public class DeviceProfile { public int cellYPaddingPx = -1; // Folder public final int numFolderRows; public final int numFolderColumns; public final float folderLabelTextScale; public int folderLabelTextSizePx; public int folderFooterHeightPx; Loading Loading @@ -439,6 +441,8 @@ public class DeviceProfile { } folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale); numFolderRows = inv.numFolderRows[mTypeIndex]; numFolderColumns = inv.numFolderColumns[mTypeIndex]; if (mIsScalableGrid && inv.folderStyle != INVALID_RESOURCE_HANDLE) { TypedArray folderStyle = context.obtainStyledAttributes(inv.folderStyle, Loading Loading @@ -645,11 +649,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); Loading Loading @@ -1406,16 +1410,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; Loading Loading @@ -2045,8 +2049,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)); Loading
src/com/android/launcher3/InvariantDeviceProfile.java +34 −6 Original line number Diff line number Diff line Loading @@ -122,8 +122,8 @@ public class InvariantDeviceProfile { /** * Number of icons per row and column in the folder. */ public int numFolderRows; public int numFolderColumns; public int[] numFolderRows; public int[] numFolderColumns; public float[] iconSize; public float[] iconTextSize; public int iconBitmapSize; Loading Loading @@ -810,8 +810,8 @@ public class InvariantDeviceProfile { public final int numSearchContainerColumns; public final int deviceCategory; private final int numFolderRows; private final int numFolderColumns; private final int[] numFolderRows = new int[COUNT_SIZES]; private final int[] numFolderColumns = new int[COUNT_SIZES]; private final @StyleRes int folderStyle; private final @StyleRes int cellStyle; Loading Loading @@ -888,11 +888,39 @@ public class InvariantDeviceProfile { a.getResourceId(R.styleable.GridDisplayOption_inlineNavButtonsEndSpacing, R.dimen.taskbar_button_margin_default); numFolderRows = a.getInt( numFolderRows[INDEX_DEFAULT] = a.getInt( R.styleable.GridDisplayOption_numFolderRows, numRows); numFolderColumns = a.getInt( numFolderColumns[INDEX_DEFAULT] = a.getInt( R.styleable.GridDisplayOption_numFolderColumns, numColumns); if (FeatureFlags.enableResponsiveWorkspace()) { numFolderRows[INDEX_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderRowsLandscape, numFolderRows[INDEX_DEFAULT]); numFolderColumns[INDEX_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderColumnsLandscape, numFolderColumns[INDEX_DEFAULT]); numFolderRows[INDEX_TWO_PANEL_PORTRAIT] = a.getInt( R.styleable.GridDisplayOption_numFolderRowsTwoPanelPortrait, numFolderRows[INDEX_DEFAULT]); numFolderColumns[INDEX_TWO_PANEL_PORTRAIT] = a.getInt( R.styleable.GridDisplayOption_numFolderColumnsTwoPanelPortrait, numFolderColumns[INDEX_DEFAULT]); numFolderRows[INDEX_TWO_PANEL_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderRowsTwoPanelLandscape, numFolderRows[INDEX_DEFAULT]); numFolderColumns[INDEX_TWO_PANEL_LANDSCAPE] = a.getInt( R.styleable.GridDisplayOption_numFolderColumnsTwoPanelLandscape, numFolderColumns[INDEX_DEFAULT]); } else { numFolderRows[INDEX_LANDSCAPE] = numFolderRows[INDEX_DEFAULT]; numFolderColumns[INDEX_LANDSCAPE] = numFolderColumns[INDEX_DEFAULT]; numFolderRows[INDEX_TWO_PANEL_PORTRAIT] = numFolderRows[INDEX_DEFAULT]; numFolderColumns[INDEX_TWO_PANEL_PORTRAIT] = numFolderColumns[INDEX_DEFAULT]; numFolderRows[INDEX_TWO_PANEL_LANDSCAPE] = numFolderRows[INDEX_DEFAULT]; numFolderColumns[INDEX_TWO_PANEL_LANDSCAPE] = numFolderColumns[INDEX_DEFAULT]; } folderStyle = a.getResourceId(R.styleable.GridDisplayOption_folderStyle, INVALID_RESOURCE_HANDLE); Loading
src/com/android/launcher3/Launcher.java +1 −1 Original line number Diff line number Diff line Loading @@ -791,7 +791,7 @@ public class Launcher extends StatefulActivity<LauncherState> if (info.container >= 0) { View folderIcon = getWorkspace().getHomescreenIconByItemId(info.container); if (folderIcon instanceof FolderIcon && folderIcon.getTag() instanceof FolderInfo) { if (new FolderGridOrganizer(getDeviceProfile().inv) if (new FolderGridOrganizer(getDeviceProfile()) .setFolderInfo((FolderInfo) folderIcon.getTag()) .isItemInPreview(info.rank)) { folderIcon.invalidate(); Loading
src/com/android/launcher3/ModelCallbacks.kt +1 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { // Cache one page worth of icons launcher.viewCache.setCacheSize( R.layout.folder_application, deviceProfile.inv.numFolderColumns * deviceProfile.inv.numFolderRows deviceProfile.numFolderColumns * deviceProfile.numFolderRows ) launcher.viewCache.setCacheSize(R.layout.folder_page, 2) TraceHelper.INSTANCE.endSection() Loading