Adding Launcher Mode settings to Launcher settings

Bug: 364711735
Test: NA
Flag: com.android.launcher3.one_grid_specs
Change-Id: Iab688ebdb8449f9258b61f59a0afe97875f82a81
This commit is contained in:
Sebastian Franco
2024-10-02 15:16:37 -07:00
parent d39c31da74
commit 9e4c99befd
11 changed files with 192 additions and 32 deletions
+29 -3
View File
@@ -617,7 +617,7 @@ public class DeviceProfile {
|| inv.inlineQsb[INDEX_TWO_PANEL_LANDSCAPE]
: inv.inlineQsb[INDEX_DEFAULT] || inv.inlineQsb[INDEX_LANDSCAPE])
&& hotseatQsbHeight > 0;
isQsbInline = mIsScalableGrid && inv.inlineQsb[mTypeIndex] && canQsbInline;
isQsbInline = isQsbInline(inv);
areNavButtonsInline = isTaskbarPresent && !isGestureMode;
numShownHotseatIcons =
@@ -850,6 +850,24 @@ public class DeviceProfile {
mDotRendererAllApps = createDotRenderer(context, allAppsIconSizePx, dotRendererCache);
}
/**
* Takes care of the logic that determines if we show a the QSB inline or not.
*/
private boolean isQsbInline(InvariantDeviceProfile inv) {
// For foldable (two panel), we inline the qsb if we have the screen open and we are in
// either Landscape or Portrait. This cal also be disabled in the device_profile.xml
boolean twoPanelCanInline = inv.inlineQsb[INDEX_TWO_PANEL_PORTRAIT]
|| inv.inlineQsb[INDEX_TWO_PANEL_LANDSCAPE];
// In tablets we inline in both orientations but only if we have enough space in the QSB
boolean tabletInlineQsb = inv.inlineQsb[INDEX_DEFAULT] || inv.inlineQsb[INDEX_LANDSCAPE];
boolean canQsbInline = isTwoPanels ? twoPanelCanInline : tabletInlineQsb;
canQsbInline = canQsbInline && hotseatQsbHeight > 0;
return (mIsScalableGrid && inv.inlineQsb[mTypeIndex] && canQsbInline)
|| inv.isFixedLandscapeMode;
}
private static DotRenderer createDotRenderer(
@NonNull Context context, int size, @NonNull SparseArray<DotRenderer> cache) {
DotRenderer renderer = cache.get(size);
@@ -1903,7 +1921,7 @@ public class DeviceProfile {
hotseatBarPadding.set(mHotseatBarWorkspaceSpacePx, paddingTop,
mInsets.right + mHotseatBarEdgePaddingPx, paddingBottom);
}
} else if (isTaskbarPresent) {
} else if (isTaskbarPresent || inv.isFixedLandscapeMode) {
// Center the QSB vertically with hotseat
int hotseatBarBottomPadding = getHotseatBarBottomPadding();
int hotseatBarTopPadding =
@@ -1922,6 +1940,13 @@ public class DeviceProfile {
}
startSpacing += getAdditionalQsbSpace();
if (inv.isFixedLandscapeMode) {
endSpacing += workspacePadding.right + cellLayoutPaddingPx.right
+ mInsets.right;
startSpacing += workspacePadding.left + cellLayoutPaddingPx.left
+ mInsets.left;
}
hotseatBarPadding.top = hotseatBarTopPadding;
hotseatBarPadding.bottom = hotseatBarBottomPadding;
boolean isRtl = Utilities.isRtl(context.getResources());
@@ -2517,7 +2542,8 @@ public class DeviceProfile {
throw new IllegalArgumentException("Window bounds not set");
}
if (mTransposeLayoutWithOrientation == null) {
mTransposeLayoutWithOrientation = !mInfo.isTablet(mWindowBounds);
mTransposeLayoutWithOrientation =
!(mInfo.isTablet(mWindowBounds) || mInv.isFixedLandscapeMode);
}
if (mIsGestureMode == null) {
mIsGestureMode = mInfo.getNavigationMode().hasGestures;