Loading res/values/attrs.xml +5 −5 Original line number Diff line number Diff line Loading @@ -261,7 +261,7 @@ <!-- Responsive grids attributes --> <declare-styleable name="ResponsiveSpec"> <attr name="specType" format="integer"> <attr name="dimensionType" format="integer"> <enum name="height" value="0" /> <enum name="width" value="1" /> </attr> Loading @@ -273,22 +273,22 @@ </declare-styleable> <declare-styleable name="WorkspaceSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> <declare-styleable name="FolderSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> <declare-styleable name="AllAppsSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> <declare-styleable name="HotseatSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> Loading src/com/android/launcher3/DeviceProfile.java +46 −42 Original line number Diff line number Diff line Loading @@ -118,10 +118,10 @@ public class DeviceProfile { // Responsive grid private final boolean mIsResponsiveGrid; private CalculatedResponsiveSpec mResponsiveWidthSpec; private CalculatedResponsiveSpec mResponsiveHeightSpec; private CalculatedResponsiveSpec mAllAppsResponsiveWidthSpec; private CalculatedResponsiveSpec mAllAppsResponsiveHeightSpec; private CalculatedResponsiveSpec mResponsiveWorkspaceWidthSpec; private CalculatedResponsiveSpec mResponsiveWorkspaceHeightSpec; private CalculatedResponsiveSpec mResponsiveAllAppsWidthSpec; private CalculatedResponsiveSpec mResponsiveAllAppsHeightSpec; private CalculatedResponsiveSpec mResponsiveFolderWidthSpec; private CalculatedResponsiveSpec mResponsiveFolderHeightSpec; private CalculatedHotseatSpec mResponsiveHotseatSpec; Loading Loading @@ -602,21 +602,21 @@ public class DeviceProfile { new ResourceHelper(context, isTwoPanels ? inv.workspaceSpecsTwoPanelId : inv.workspaceSpecsId), ResponsiveSpecType.Workspace); mResponsiveWidthSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveWorkspaceWidthSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.WIDTH, numWorkspaceColumns, availableResponsiveWidth); mResponsiveHeightSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveWorkspaceHeightSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.HEIGHT, inv.numRows, availableResponsiveHeight); ResponsiveSpecsProvider allAppsSpecs = ResponsiveSpecsProvider.create( new ResourceHelper(context, isTwoPanels ? inv.allAppsSpecsTwoPanelId : inv.allAppsSpecsId), ResponsiveSpecType.AllApps); mAllAppsResponsiveWidthSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveAllAppsWidthSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.WIDTH, numAllAppsColumns, availableWidthPx, mResponsiveWidthSpec); mAllAppsResponsiveHeightSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveWorkspaceWidthSpec); mResponsiveAllAppsHeightSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.HEIGHT, inv.numRows, heightPx - mInsets.top, mResponsiveHeightSpec); mResponsiveWorkspaceHeightSpec); ResponsiveSpecsProvider folderSpecs = ResponsiveSpecsProvider.create( new ResourceHelper(context, Loading @@ -624,12 +624,12 @@ public class DeviceProfile { ResponsiveSpecType.Folder); mResponsiveFolderWidthSpec = folderSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.WIDTH, inv.numFolderColumns, mResponsiveWidthSpec.getAvailableSpace(), mResponsiveWidthSpec); mResponsiveWorkspaceWidthSpec.getAvailableSpace(), mResponsiveWorkspaceWidthSpec); mResponsiveFolderHeightSpec = folderSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.HEIGHT, inv.numFolderRows, mResponsiveHeightSpec.getAvailableSpace(), mResponsiveHeightSpec); mResponsiveWorkspaceHeightSpec.getAvailableSpace(), mResponsiveWorkspaceHeightSpec); } desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res); Loading Loading @@ -759,7 +759,7 @@ public class DeviceProfile { private int getHorizontalMarginPx(InvariantDeviceProfile idp, Resources res) { if (mIsResponsiveGrid) { return mResponsiveWidthSpec.getStartPaddingPx(); return mResponsiveWorkspaceWidthSpec.getStartPaddingPx(); } if (isVerticalBarLayout()) { Loading @@ -775,8 +775,8 @@ public class DeviceProfile { InvariantDeviceProfile inv, int extraSpace) { if (mIsResponsiveGrid) { workspaceTopPadding = mResponsiveHeightSpec.getStartPaddingPx(); workspaceBottomPadding = mResponsiveHeightSpec.getEndPaddingPx(); workspaceTopPadding = mResponsiveWorkspaceHeightSpec.getStartPaddingPx(); workspaceBottomPadding = mResponsiveWorkspaceHeightSpec.getEndPaddingPx(); } else if (mIsScalableGrid && inv.devicePaddingId != INVALID_RESOURCE_HANDLE) { // Paddings were created assuming no scaling, so we first unscale the extra space. int unscaledExtraSpace = (int) (extraSpace / cellScaleToFit); Loading Loading @@ -872,8 +872,8 @@ public class DeviceProfile { int verticalSpacePx = 0; if (mIsResponsiveGrid) { horizontalSpacePx = mResponsiveWidthSpec.getGutterPx(); verticalSpacePx = mResponsiveHeightSpec.getGutterPx(); horizontalSpacePx = mResponsiveWorkspaceWidthSpec.getGutterPx(); verticalSpacePx = mResponsiveWorkspaceHeightSpec.getGutterPx(); } else if (mIsScalableGrid) { horizontalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].x, mMetrics, scale); verticalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].y, mMetrics, scale); Loading Loading @@ -1060,8 +1060,8 @@ public class DeviceProfile { cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv, scale); if (mIsResponsiveGrid) { cellWidthPx = mResponsiveWidthSpec.getCellSizePx(); cellHeightPx = mResponsiveHeightSpec.getCellSizePx(); cellWidthPx = mResponsiveWorkspaceWidthSpec.getCellSizePx(); cellHeightPx = mResponsiveWorkspaceHeightSpec.getCellSizePx(); if (cellWidthPx < iconSizePx) { // get a smaller icon size Loading Loading @@ -1266,24 +1266,24 @@ public class DeviceProfile { private void updateAllAppsWithResponsiveMeasures(Resources res) { allAppsBorderSpacePx = new Point( mAllAppsResponsiveWidthSpec.getGutterPx(), mAllAppsResponsiveHeightSpec.getGutterPx() mResponsiveAllAppsWidthSpec.getGutterPx(), mResponsiveAllAppsHeightSpec.getGutterPx() ); allAppsCellHeightPx = mAllAppsResponsiveHeightSpec.getCellSizePx() + mAllAppsResponsiveHeightSpec.getGutterPx(); allAppsCellWidthPx = mAllAppsResponsiveWidthSpec.getCellSizePx(); allAppsCellHeightPx = mResponsiveAllAppsHeightSpec.getCellSizePx() + mResponsiveAllAppsHeightSpec.getGutterPx(); allAppsCellWidthPx = mResponsiveAllAppsWidthSpec.getCellSizePx(); // This workaround is needed to align AllApps icons with Workspace icons // since AllApps doesn't have borders between cells int halfBorder = allAppsBorderSpacePx.x / 2; allAppsPadding.left = mAllAppsResponsiveWidthSpec.getStartPaddingPx() - halfBorder; allAppsPadding.right = mAllAppsResponsiveWidthSpec.getEndPaddingPx() - halfBorder; allAppsPadding.left = mResponsiveAllAppsWidthSpec.getStartPaddingPx() - halfBorder; allAppsPadding.right = mResponsiveAllAppsWidthSpec.getEndPaddingPx() - halfBorder; // TODO(b/287975993): Remove this after icon size is extracted to responsive grid // Copy icon size from the workspace when spec is matchWorkspace or // use the default all apps icon size if (mAllAppsResponsiveHeightSpec.isCellSizeMatchWorkspace() || mAllAppsResponsiveWidthSpec.isCellSizeMatchWorkspace()) { if (mResponsiveAllAppsHeightSpec.isCellSizeMatchWorkspace() || mResponsiveAllAppsWidthSpec.isCellSizeMatchWorkspace()) { allAppsIconSizePx = iconSizePx; allAppsIconTextSizePx = iconTextSizePx; allAppsIconDrawablePaddingPx = iconDrawablePaddingPx; Loading Loading @@ -1588,15 +1588,17 @@ public class DeviceProfile { Rect padding = workspacePadding; if (isVerticalBarLayout()) { if (mIsResponsiveGrid) { padding.top = mResponsiveHeightSpec.getStartPaddingPx(); padding.top = mResponsiveWorkspaceHeightSpec.getStartPaddingPx(); padding.bottom = Math.max(0, mResponsiveHeightSpec.getEndPaddingPx() - mInsets.bottom); mResponsiveWorkspaceHeightSpec.getEndPaddingPx() - mInsets.bottom); if (isSeascape()) { padding.left = hotseatBarSizePx + mResponsiveWidthSpec.getEndPaddingPx(); padding.right = mResponsiveWidthSpec.getStartPaddingPx(); padding.left = hotseatBarSizePx + mResponsiveWorkspaceWidthSpec.getEndPaddingPx(); padding.right = mResponsiveWorkspaceWidthSpec.getStartPaddingPx(); } else { padding.left = mResponsiveWidthSpec.getStartPaddingPx(); padding.right = hotseatBarSizePx + mResponsiveWidthSpec.getEndPaddingPx(); padding.left = mResponsiveWorkspaceWidthSpec.getStartPaddingPx(); padding.right = hotseatBarSizePx + mResponsiveWorkspaceWidthSpec.getEndPaddingPx(); } } else { padding.top = 0; Loading Loading @@ -2118,12 +2120,14 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("getCellLayoutHeight()", getCellLayoutHeight())); writer.println(prefix + pxToDpStr("getCellLayoutWidth()", getCellLayoutWidth())); if (mIsResponsiveGrid) { writer.println(prefix + "\tmResponsiveHeightSpec:" + mResponsiveHeightSpec.toString()); writer.println(prefix + "\tmResponsiveWidthSpec:" + mResponsiveWidthSpec.toString()); writer.println(prefix + "\tmAllAppsResponsiveHeightSpec:" + mAllAppsResponsiveHeightSpec.toString()); writer.println(prefix + "\tmAllAppsResponsiveWidthSpec:" + mAllAppsResponsiveWidthSpec.toString()); writer.println(prefix + "\tmResponsiveWorkspaceHeightSpec:" + mResponsiveWorkspaceHeightSpec.toString()); writer.println(prefix + "\tmResponsiveWorkspaceWidthSpec:" + mResponsiveWorkspaceWidthSpec.toString()); writer.println(prefix + "\tmResponsiveAllAppsHeightSpec:" + mResponsiveAllAppsHeightSpec.toString()); writer.println(prefix + "\tmResponsiveAllAppsWidthSpec:" + mResponsiveAllAppsWidthSpec.toString()); writer.println(prefix + "\tmResponsiveFolderHeightSpec:" + mResponsiveFolderHeightSpec); writer.println(prefix + "\tmResponsiveFolderWidthSpec:" + mResponsiveFolderWidthSpec); writer.println(prefix + "\tmResponsiveHotseatSpec:" + mResponsiveHotseatSpec); Loading src/com/android/launcher3/responsive/HotseatSpecsProvider.kt +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ data class HotseatSpec( dimensionType = DimensionType.entries[ attrs.getInt( R.styleable.ResponsiveSpec_specType, R.styleable.ResponsiveSpec_dimensionType, DimensionType.HEIGHT.ordinal )], specType = responsiveSpecType, Loading src/com/android/launcher3/responsive/ResponsiveSpec.kt +9 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ data class ResponsiveSpec( dimensionType = DimensionType.entries[ attrs.getInt( R.styleable.ResponsiveSpec_specType, R.styleable.ResponsiveSpec_dimensionType, DimensionType.HEIGHT.ordinal )], specType = responsiveSpecType, Loading Loading @@ -137,6 +137,9 @@ data class ResponsiveSpec( * they are calculated from the available space, cells and workspace specs. */ class CalculatedResponsiveSpec { var aspectRatio: Float = Float.NaN private set var availableSpace: Int = 0 private set Loading @@ -159,11 +162,13 @@ class CalculatedResponsiveSpec { private set constructor( aspectRatio: Float, availableSpace: Int, cells: Int, spec: ResponsiveSpec, calculatedWorkspaceSpec: CalculatedResponsiveSpec ) { this.aspectRatio = aspectRatio this.availableSpace = availableSpace this.cells = cells this.spec = spec Loading @@ -183,7 +188,8 @@ class CalculatedResponsiveSpec { updateRemainderSpaces(availableSpace, cells, spec) } constructor(availableSpace: Int, cells: Int, spec: ResponsiveSpec) { constructor(aspectRatio: Float, availableSpace: Int, cells: Int, spec: ResponsiveSpec) { this.aspectRatio = aspectRatio this.availableSpace = availableSpace this.cells = cells this.spec = spec Loading Loading @@ -239,6 +245,7 @@ class CalculatedResponsiveSpec { return "Calculated${spec.specType}Spec(" + "availableSpace=$availableSpace, cells=$cells, startPaddingPx=$startPaddingPx, " + "endPaddingPx=$endPaddingPx, gutterPx=$gutterPx, cellSizePx=$cellSizePx, " + "aspectRatio=${aspectRatio}, " + "${spec.specType}Spec.maxAvailableSize=${spec.maxAvailableSize}" + ")" } Loading src/com/android/launcher3/responsive/ResponsiveSpecsProvider.kt +8 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ class ResponsiveSpecsProvider( ): CalculatedResponsiveSpec { val specsGroup = getSpecsByAspectRatio(aspectRatio) val spec = specsGroup.getSpec(dimensionType, availableSpace) return CalculatedResponsiveSpec(availableSpace, numCells, spec) return CalculatedResponsiveSpec(aspectRatio, availableSpace, numCells, spec) } /** Loading Loading @@ -114,7 +114,13 @@ class ResponsiveSpecsProvider( val specsGroup = getSpecsByAspectRatio(aspectRatio) val spec = specsGroup.getSpec(dimensionType, availableSpace) return CalculatedResponsiveSpec(availableSpace, numCells, spec, calculatedWorkspaceSpec) return CalculatedResponsiveSpec( aspectRatio, availableSpace, numCells, spec, calculatedWorkspaceSpec ) } companion object { Loading Loading
res/values/attrs.xml +5 −5 Original line number Diff line number Diff line Loading @@ -261,7 +261,7 @@ <!-- Responsive grids attributes --> <declare-styleable name="ResponsiveSpec"> <attr name="specType" format="integer"> <attr name="dimensionType" format="integer"> <enum name="height" value="0" /> <enum name="width" value="1" /> </attr> Loading @@ -273,22 +273,22 @@ </declare-styleable> <declare-styleable name="WorkspaceSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> <declare-styleable name="FolderSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> <declare-styleable name="AllAppsSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> <declare-styleable name="HotseatSpec"> <attr name="specType" /> <attr name="dimensionType" /> <attr name="maxAvailableSize" /> </declare-styleable> Loading
src/com/android/launcher3/DeviceProfile.java +46 −42 Original line number Diff line number Diff line Loading @@ -118,10 +118,10 @@ public class DeviceProfile { // Responsive grid private final boolean mIsResponsiveGrid; private CalculatedResponsiveSpec mResponsiveWidthSpec; private CalculatedResponsiveSpec mResponsiveHeightSpec; private CalculatedResponsiveSpec mAllAppsResponsiveWidthSpec; private CalculatedResponsiveSpec mAllAppsResponsiveHeightSpec; private CalculatedResponsiveSpec mResponsiveWorkspaceWidthSpec; private CalculatedResponsiveSpec mResponsiveWorkspaceHeightSpec; private CalculatedResponsiveSpec mResponsiveAllAppsWidthSpec; private CalculatedResponsiveSpec mResponsiveAllAppsHeightSpec; private CalculatedResponsiveSpec mResponsiveFolderWidthSpec; private CalculatedResponsiveSpec mResponsiveFolderHeightSpec; private CalculatedHotseatSpec mResponsiveHotseatSpec; Loading Loading @@ -602,21 +602,21 @@ public class DeviceProfile { new ResourceHelper(context, isTwoPanels ? inv.workspaceSpecsTwoPanelId : inv.workspaceSpecsId), ResponsiveSpecType.Workspace); mResponsiveWidthSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveWorkspaceWidthSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.WIDTH, numWorkspaceColumns, availableResponsiveWidth); mResponsiveHeightSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveWorkspaceHeightSpec = workspaceSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.HEIGHT, inv.numRows, availableResponsiveHeight); ResponsiveSpecsProvider allAppsSpecs = ResponsiveSpecsProvider.create( new ResourceHelper(context, isTwoPanels ? inv.allAppsSpecsTwoPanelId : inv.allAppsSpecsId), ResponsiveSpecType.AllApps); mAllAppsResponsiveWidthSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveAllAppsWidthSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.WIDTH, numAllAppsColumns, availableWidthPx, mResponsiveWidthSpec); mAllAppsResponsiveHeightSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, mResponsiveWorkspaceWidthSpec); mResponsiveAllAppsHeightSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.HEIGHT, inv.numRows, heightPx - mInsets.top, mResponsiveHeightSpec); mResponsiveWorkspaceHeightSpec); ResponsiveSpecsProvider folderSpecs = ResponsiveSpecsProvider.create( new ResourceHelper(context, Loading @@ -624,12 +624,12 @@ public class DeviceProfile { ResponsiveSpecType.Folder); mResponsiveFolderWidthSpec = folderSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.WIDTH, inv.numFolderColumns, mResponsiveWidthSpec.getAvailableSpace(), mResponsiveWidthSpec); mResponsiveWorkspaceWidthSpec.getAvailableSpace(), mResponsiveWorkspaceWidthSpec); mResponsiveFolderHeightSpec = folderSpecs.getCalculatedSpec(responsiveAspectRatio, DimensionType.HEIGHT, inv.numFolderRows, mResponsiveHeightSpec.getAvailableSpace(), mResponsiveHeightSpec); mResponsiveWorkspaceHeightSpec.getAvailableSpace(), mResponsiveWorkspaceHeightSpec); } desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res); Loading Loading @@ -759,7 +759,7 @@ public class DeviceProfile { private int getHorizontalMarginPx(InvariantDeviceProfile idp, Resources res) { if (mIsResponsiveGrid) { return mResponsiveWidthSpec.getStartPaddingPx(); return mResponsiveWorkspaceWidthSpec.getStartPaddingPx(); } if (isVerticalBarLayout()) { Loading @@ -775,8 +775,8 @@ public class DeviceProfile { InvariantDeviceProfile inv, int extraSpace) { if (mIsResponsiveGrid) { workspaceTopPadding = mResponsiveHeightSpec.getStartPaddingPx(); workspaceBottomPadding = mResponsiveHeightSpec.getEndPaddingPx(); workspaceTopPadding = mResponsiveWorkspaceHeightSpec.getStartPaddingPx(); workspaceBottomPadding = mResponsiveWorkspaceHeightSpec.getEndPaddingPx(); } else if (mIsScalableGrid && inv.devicePaddingId != INVALID_RESOURCE_HANDLE) { // Paddings were created assuming no scaling, so we first unscale the extra space. int unscaledExtraSpace = (int) (extraSpace / cellScaleToFit); Loading Loading @@ -872,8 +872,8 @@ public class DeviceProfile { int verticalSpacePx = 0; if (mIsResponsiveGrid) { horizontalSpacePx = mResponsiveWidthSpec.getGutterPx(); verticalSpacePx = mResponsiveHeightSpec.getGutterPx(); horizontalSpacePx = mResponsiveWorkspaceWidthSpec.getGutterPx(); verticalSpacePx = mResponsiveWorkspaceHeightSpec.getGutterPx(); } else if (mIsScalableGrid) { horizontalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].x, mMetrics, scale); verticalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].y, mMetrics, scale); Loading Loading @@ -1060,8 +1060,8 @@ public class DeviceProfile { cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv, scale); if (mIsResponsiveGrid) { cellWidthPx = mResponsiveWidthSpec.getCellSizePx(); cellHeightPx = mResponsiveHeightSpec.getCellSizePx(); cellWidthPx = mResponsiveWorkspaceWidthSpec.getCellSizePx(); cellHeightPx = mResponsiveWorkspaceHeightSpec.getCellSizePx(); if (cellWidthPx < iconSizePx) { // get a smaller icon size Loading Loading @@ -1266,24 +1266,24 @@ public class DeviceProfile { private void updateAllAppsWithResponsiveMeasures(Resources res) { allAppsBorderSpacePx = new Point( mAllAppsResponsiveWidthSpec.getGutterPx(), mAllAppsResponsiveHeightSpec.getGutterPx() mResponsiveAllAppsWidthSpec.getGutterPx(), mResponsiveAllAppsHeightSpec.getGutterPx() ); allAppsCellHeightPx = mAllAppsResponsiveHeightSpec.getCellSizePx() + mAllAppsResponsiveHeightSpec.getGutterPx(); allAppsCellWidthPx = mAllAppsResponsiveWidthSpec.getCellSizePx(); allAppsCellHeightPx = mResponsiveAllAppsHeightSpec.getCellSizePx() + mResponsiveAllAppsHeightSpec.getGutterPx(); allAppsCellWidthPx = mResponsiveAllAppsWidthSpec.getCellSizePx(); // This workaround is needed to align AllApps icons with Workspace icons // since AllApps doesn't have borders between cells int halfBorder = allAppsBorderSpacePx.x / 2; allAppsPadding.left = mAllAppsResponsiveWidthSpec.getStartPaddingPx() - halfBorder; allAppsPadding.right = mAllAppsResponsiveWidthSpec.getEndPaddingPx() - halfBorder; allAppsPadding.left = mResponsiveAllAppsWidthSpec.getStartPaddingPx() - halfBorder; allAppsPadding.right = mResponsiveAllAppsWidthSpec.getEndPaddingPx() - halfBorder; // TODO(b/287975993): Remove this after icon size is extracted to responsive grid // Copy icon size from the workspace when spec is matchWorkspace or // use the default all apps icon size if (mAllAppsResponsiveHeightSpec.isCellSizeMatchWorkspace() || mAllAppsResponsiveWidthSpec.isCellSizeMatchWorkspace()) { if (mResponsiveAllAppsHeightSpec.isCellSizeMatchWorkspace() || mResponsiveAllAppsWidthSpec.isCellSizeMatchWorkspace()) { allAppsIconSizePx = iconSizePx; allAppsIconTextSizePx = iconTextSizePx; allAppsIconDrawablePaddingPx = iconDrawablePaddingPx; Loading Loading @@ -1588,15 +1588,17 @@ public class DeviceProfile { Rect padding = workspacePadding; if (isVerticalBarLayout()) { if (mIsResponsiveGrid) { padding.top = mResponsiveHeightSpec.getStartPaddingPx(); padding.top = mResponsiveWorkspaceHeightSpec.getStartPaddingPx(); padding.bottom = Math.max(0, mResponsiveHeightSpec.getEndPaddingPx() - mInsets.bottom); mResponsiveWorkspaceHeightSpec.getEndPaddingPx() - mInsets.bottom); if (isSeascape()) { padding.left = hotseatBarSizePx + mResponsiveWidthSpec.getEndPaddingPx(); padding.right = mResponsiveWidthSpec.getStartPaddingPx(); padding.left = hotseatBarSizePx + mResponsiveWorkspaceWidthSpec.getEndPaddingPx(); padding.right = mResponsiveWorkspaceWidthSpec.getStartPaddingPx(); } else { padding.left = mResponsiveWidthSpec.getStartPaddingPx(); padding.right = hotseatBarSizePx + mResponsiveWidthSpec.getEndPaddingPx(); padding.left = mResponsiveWorkspaceWidthSpec.getStartPaddingPx(); padding.right = hotseatBarSizePx + mResponsiveWorkspaceWidthSpec.getEndPaddingPx(); } } else { padding.top = 0; Loading Loading @@ -2118,12 +2120,14 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("getCellLayoutHeight()", getCellLayoutHeight())); writer.println(prefix + pxToDpStr("getCellLayoutWidth()", getCellLayoutWidth())); if (mIsResponsiveGrid) { writer.println(prefix + "\tmResponsiveHeightSpec:" + mResponsiveHeightSpec.toString()); writer.println(prefix + "\tmResponsiveWidthSpec:" + mResponsiveWidthSpec.toString()); writer.println(prefix + "\tmAllAppsResponsiveHeightSpec:" + mAllAppsResponsiveHeightSpec.toString()); writer.println(prefix + "\tmAllAppsResponsiveWidthSpec:" + mAllAppsResponsiveWidthSpec.toString()); writer.println(prefix + "\tmResponsiveWorkspaceHeightSpec:" + mResponsiveWorkspaceHeightSpec.toString()); writer.println(prefix + "\tmResponsiveWorkspaceWidthSpec:" + mResponsiveWorkspaceWidthSpec.toString()); writer.println(prefix + "\tmResponsiveAllAppsHeightSpec:" + mResponsiveAllAppsHeightSpec.toString()); writer.println(prefix + "\tmResponsiveAllAppsWidthSpec:" + mResponsiveAllAppsWidthSpec.toString()); writer.println(prefix + "\tmResponsiveFolderHeightSpec:" + mResponsiveFolderHeightSpec); writer.println(prefix + "\tmResponsiveFolderWidthSpec:" + mResponsiveFolderWidthSpec); writer.println(prefix + "\tmResponsiveHotseatSpec:" + mResponsiveHotseatSpec); Loading
src/com/android/launcher3/responsive/HotseatSpecsProvider.kt +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ data class HotseatSpec( dimensionType = DimensionType.entries[ attrs.getInt( R.styleable.ResponsiveSpec_specType, R.styleable.ResponsiveSpec_dimensionType, DimensionType.HEIGHT.ordinal )], specType = responsiveSpecType, Loading
src/com/android/launcher3/responsive/ResponsiveSpec.kt +9 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ data class ResponsiveSpec( dimensionType = DimensionType.entries[ attrs.getInt( R.styleable.ResponsiveSpec_specType, R.styleable.ResponsiveSpec_dimensionType, DimensionType.HEIGHT.ordinal )], specType = responsiveSpecType, Loading Loading @@ -137,6 +137,9 @@ data class ResponsiveSpec( * they are calculated from the available space, cells and workspace specs. */ class CalculatedResponsiveSpec { var aspectRatio: Float = Float.NaN private set var availableSpace: Int = 0 private set Loading @@ -159,11 +162,13 @@ class CalculatedResponsiveSpec { private set constructor( aspectRatio: Float, availableSpace: Int, cells: Int, spec: ResponsiveSpec, calculatedWorkspaceSpec: CalculatedResponsiveSpec ) { this.aspectRatio = aspectRatio this.availableSpace = availableSpace this.cells = cells this.spec = spec Loading @@ -183,7 +188,8 @@ class CalculatedResponsiveSpec { updateRemainderSpaces(availableSpace, cells, spec) } constructor(availableSpace: Int, cells: Int, spec: ResponsiveSpec) { constructor(aspectRatio: Float, availableSpace: Int, cells: Int, spec: ResponsiveSpec) { this.aspectRatio = aspectRatio this.availableSpace = availableSpace this.cells = cells this.spec = spec Loading Loading @@ -239,6 +245,7 @@ class CalculatedResponsiveSpec { return "Calculated${spec.specType}Spec(" + "availableSpace=$availableSpace, cells=$cells, startPaddingPx=$startPaddingPx, " + "endPaddingPx=$endPaddingPx, gutterPx=$gutterPx, cellSizePx=$cellSizePx, " + "aspectRatio=${aspectRatio}, " + "${spec.specType}Spec.maxAvailableSize=${spec.maxAvailableSize}" + ")" } Loading
src/com/android/launcher3/responsive/ResponsiveSpecsProvider.kt +8 −2 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ class ResponsiveSpecsProvider( ): CalculatedResponsiveSpec { val specsGroup = getSpecsByAspectRatio(aspectRatio) val spec = specsGroup.getSpec(dimensionType, availableSpace) return CalculatedResponsiveSpec(availableSpace, numCells, spec) return CalculatedResponsiveSpec(aspectRatio, availableSpace, numCells, spec) } /** Loading Loading @@ -114,7 +114,13 @@ class ResponsiveSpecsProvider( val specsGroup = getSpecsByAspectRatio(aspectRatio) val spec = specsGroup.getSpec(dimensionType, availableSpace) return CalculatedResponsiveSpec(availableSpace, numCells, spec, calculatedWorkspaceSpec) return CalculatedResponsiveSpec( aspectRatio, availableSpace, numCells, spec, calculatedWorkspaceSpec ) } companion object { Loading