mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Merge "Fix flag guarding for oneGridRotationHandling" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
230b2f50a7
@@ -510,7 +510,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
private List<DisplayOption> getPredefinedDeviceProfiles(Context context,
|
||||
private static List<DisplayOption> getPredefinedDeviceProfiles(Context context,
|
||||
String gridName, @DeviceType int deviceType, boolean allowDisabledGrid) {
|
||||
ArrayList<DisplayOption> profiles = new ArrayList<>();
|
||||
|
||||
@@ -524,7 +524,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
|
||||
GridOption gridOption = new GridOption(context, Xml.asAttributeSet(parser));
|
||||
if ((gridOption.isEnabled(deviceType) || allowDisabledGrid)
|
||||
&& (Flags.oneGridSpecs() == gridOption.isNewGridOption())) {
|
||||
&& gridOption.filterByFlag(deviceType)) {
|
||||
final int displayDepth = parser.getDepth();
|
||||
while (((type = parser.next()) != XmlPullParser.END_TAG
|
||||
|| parser.getDepth() > displayDepth)
|
||||
@@ -680,7 +680,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
return parseAllDefinedGridOptions(context)
|
||||
.stream()
|
||||
.filter(go -> go.isEnabled(deviceType))
|
||||
.filter(go -> (Flags.oneGridSpecs() == go.isNewGridOption()))
|
||||
.filter(go -> go.filterByFlag(deviceType))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -937,6 +937,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
private final int demoModeLayoutId;
|
||||
|
||||
private final boolean isScalable;
|
||||
private final boolean mIsDualGrid;
|
||||
private final int devicePaddingId;
|
||||
private final int mWorkspaceSpecsId;
|
||||
private final int mWorkspaceSpecsTwoPanelId;
|
||||
@@ -961,6 +962,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
DEVICE_CATEGORY_ALL);
|
||||
mRowCountSpecsId = a.getResourceId(
|
||||
R.styleable.GridDisplayOption_rowCountSpecsId, INVALID_RESOURCE_HANDLE);
|
||||
mIsDualGrid = a.getBoolean(R.styleable.GridDisplayOption_isDualGrid, false);
|
||||
if (mRowCountSpecsId != INVALID_RESOURCE_HANDLE) {
|
||||
ResourceHelper resourceHelper = new ResourceHelper(context, mRowCountSpecsId);
|
||||
NumRows numR = getRowCount(resourceHelper, context, deviceCategory);
|
||||
@@ -1124,6 +1126,13 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
public boolean isNewGridOption() {
|
||||
return mRowCountSpecsId != INVALID_RESOURCE_HANDLE;
|
||||
}
|
||||
|
||||
public boolean filterByFlag(int deviceType) {
|
||||
if (deviceType == TYPE_TABLET) {
|
||||
return Flags.oneGridRotationHandling() == mIsDualGrid;
|
||||
}
|
||||
return Flags.oneGridSpecs() == isNewGridOption();
|
||||
}
|
||||
}
|
||||
|
||||
public static final class NumRows {
|
||||
|
||||
Reference in New Issue
Block a user