diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 9803779bf1..4d75fb856d 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -205,13 +205,16 @@ + + + diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 791ee53c0a..28e0cf2de7 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -543,7 +543,8 @@ public class DeviceProfile { // for the available height to be correct if (mIsResponsiveGrid) { WorkspaceSpecs workspaceSpecs = WorkspaceSpecs.create( - new ResourceHelper(context, inv.workspaceSpecsId)); + new ResourceHelper(context, + isTwoPanels ? inv.workspaceSpecsTwoPanelId : inv.workspaceSpecsId)); int availableResponsiveWidth = availableWidthPx - (isVerticalBarLayout() ? hotseatBarSizePx : 0); int numColumns = getPanelCount() * inv.numColumns; @@ -557,14 +558,16 @@ public class DeviceProfile { availableResponsiveHeight); AllAppsSpecs allAppsSpecs = AllAppsSpecs.create( - new ResourceHelper(context, inv.allAppsSpecsId)); + new ResourceHelper(context, + isTwoPanels ? inv.allAppsSpecsTwoPanelId : inv.allAppsSpecsId)); mAllAppsResponsiveWidthSpec = allAppsSpecs.getCalculatedWidthSpec(numColumns, mResponsiveWidthSpec.getAvailableSpace(), mResponsiveWidthSpec); mAllAppsResponsiveHeightSpec = allAppsSpecs.getCalculatedHeightSpec(inv.numRows, mResponsiveHeightSpec.getAvailableSpace(), mResponsiveHeightSpec); FolderSpecs folderSpecs = FolderSpecs.create( - new ResourceHelper(context, inv.folderSpecsId)); + new ResourceHelper(context, + isTwoPanels ? inv.folderSpecsTwoPanelId : inv.folderSpecsId)); mResponsiveFolderWidthSpec = folderSpecs.getCalculatedWidthSpec(inv.numFolderColumns, mResponsiveWidthSpec.getAvailableSpace(), mResponsiveWidthSpec); mResponsiveFolderHeightSpec = folderSpecs.getCalculatedHeightSpec(inv.numFolderRows, diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 4eaacdc17c..dac6120e1b 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -180,9 +180,15 @@ public class InvariantDeviceProfile { @XmlRes public int workspaceSpecsId = INVALID_RESOURCE_HANDLE; @XmlRes + public int workspaceSpecsTwoPanelId = INVALID_RESOURCE_HANDLE; + @XmlRes public int allAppsSpecsId = INVALID_RESOURCE_HANDLE; @XmlRes + public int allAppsSpecsTwoPanelId = INVALID_RESOURCE_HANDLE; + @XmlRes public int folderSpecsId = INVALID_RESOURCE_HANDLE; + @XmlRes + public int folderSpecsTwoPanelId = INVALID_RESOURCE_HANDLE; public String dbFile; public int defaultLayoutId; @@ -357,8 +363,11 @@ public class InvariantDeviceProfile { isScalable = closestProfile.isScalable; devicePaddingId = closestProfile.devicePaddingId; workspaceSpecsId = closestProfile.mWorkspaceSpecsId; + workspaceSpecsTwoPanelId = closestProfile.mWorkspaceSpecsTwoPanelId; allAppsSpecsId = closestProfile.mAllAppsSpecsId; + allAppsSpecsTwoPanelId = closestProfile.mAllAppsSpecsTwoPanelId; folderSpecsId = closestProfile.mFolderSpecsId; + folderSpecsTwoPanelId = closestProfile.mFolderSpecsTwoPanelId; this.deviceType = deviceType; inlineNavButtonsEndSpacing = closestProfile.inlineNavButtonsEndSpacing; @@ -805,8 +814,11 @@ public class InvariantDeviceProfile { private final boolean isScalable; private final int devicePaddingId; private final int mWorkspaceSpecsId; + private final int mWorkspaceSpecsTwoPanelId; private final int mAllAppsSpecsId; + private final int mAllAppsSpecsTwoPanelId; private final int mFolderSpecsId; + private final int mFolderSpecsTwoPanelId; public GridOption(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes( @@ -871,14 +883,26 @@ public class InvariantDeviceProfile { if (FeatureFlags.ENABLE_RESPONSIVE_WORKSPACE.get()) { mWorkspaceSpecsId = a.getResourceId( R.styleable.GridDisplayOption_workspaceSpecsId, INVALID_RESOURCE_HANDLE); + mWorkspaceSpecsTwoPanelId = a.getResourceId( + R.styleable.GridDisplayOption_workspaceSpecsTwoPanelId, + INVALID_RESOURCE_HANDLE); mAllAppsSpecsId = a.getResourceId( R.styleable.GridDisplayOption_allAppsSpecsId, INVALID_RESOURCE_HANDLE); + mAllAppsSpecsTwoPanelId = a.getResourceId( + R.styleable.GridDisplayOption_allAppsSpecsTwoPanelId, + INVALID_RESOURCE_HANDLE); mFolderSpecsId = a.getResourceId( R.styleable.GridDisplayOption_folderSpecsId, INVALID_RESOURCE_HANDLE); + mFolderSpecsTwoPanelId = a.getResourceId( + R.styleable.GridDisplayOption_folderSpecsTwoPanelId, + INVALID_RESOURCE_HANDLE); } else { mWorkspaceSpecsId = INVALID_RESOURCE_HANDLE; + mWorkspaceSpecsTwoPanelId = INVALID_RESOURCE_HANDLE; mAllAppsSpecsId = INVALID_RESOURCE_HANDLE; + mAllAppsSpecsTwoPanelId = INVALID_RESOURCE_HANDLE; mFolderSpecsId = INVALID_RESOURCE_HANDLE; + mFolderSpecsTwoPanelId = INVALID_RESOURCE_HANDLE; } int inlineForRotation = a.getInt(R.styleable.GridDisplayOption_inlineQsb,