Use less icons in hotseat when in 3 button nav for tablet
- We have less space on tablets when 3 button nav is enabled because QSB is now inline with the icons. This creates a new attribute to define how many icons should be shown when in that mode. This could be used for other grids in the future as well.
- InvariantDeviceProfile now listens for nav mode changes
Fixes 214882090, 221420204
Test: manual
Change-Id: I012432a1a322c4e5505e46a1198c841ab124aaa6
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 97c0f38..cd9bbf7 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -34,7 +34,6 @@
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.IconNormalizer;
@@ -59,6 +58,7 @@
// Device properties
public final boolean isTablet;
+ public final boolean isLargeTablet;
public final boolean isPhone;
public final boolean transposeLayoutWithOrientation;
public final boolean isTwoPanels;
@@ -67,6 +67,7 @@
// Device properties in current orientation
public final boolean isLandscape;
public final boolean isMultiWindowMode;
+ public final boolean isGestureMode;
public final int windowX;
public final int windowY;
@@ -229,12 +230,13 @@
/** TODO: Once we fully migrate to staged split, remove "isMultiWindowMode" */
DeviceProfile(Context context, InvariantDeviceProfile inv, Info info, WindowBounds windowBounds,
boolean isMultiWindowMode, boolean transposeLayoutWithOrientation,
- boolean useTwoPanels) {
+ boolean useTwoPanels, boolean isGestureMode) {
this.inv = inv;
this.isLandscape = windowBounds.isLandscape();
this.isMultiWindowMode = isMultiWindowMode;
this.transposeLayoutWithOrientation = transposeLayoutWithOrientation;
+ this.isGestureMode = isGestureMode;
windowX = windowBounds.bounds.left;
windowY = windowBounds.bounds.top;
@@ -243,6 +245,7 @@
// Determine device posture.
mInfo = info;
isTablet = info.isTablet(windowBounds);
+ isLargeTablet = info.isLargeTablet(windowBounds);
isPhone = !isTablet;
isTwoPanels = isTablet && useTwoPanels;
isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS;
@@ -343,9 +346,15 @@
workspaceCellPaddingXPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x);
hotseatQsbHeight = res.getDimensionPixelSize(R.dimen.qsb_widget_height);
- isQsbInline = isTablet && isLandscape && !isTwoPanels && hotseatQsbHeight > 0;
- numShownHotseatIcons =
- isTwoPanels ? inv.numDatabaseHotseatIcons : inv.numShownHotseatIcons;
+ isQsbInline = isLargeTablet && isLandscape && hotseatQsbHeight > 0;
+
+ if (isTaskbarPresent && !isGestureMode && isQsbInline) {
+ numShownHotseatIcons = inv.numShrunkenHotseatIcons;
+ } else {
+ numShownHotseatIcons =
+ isTwoPanels ? inv.numDatabaseHotseatIcons : inv.numShownHotseatIcons;
+ }
+
numShownAllAppsColumns =
isTwoPanels ? inv.numDatabaseAllAppsColumns : inv.numAllAppsColumns;
hotseatBarSizeExtraSpacePx = 0;
@@ -540,7 +549,8 @@
return new Builder(context, inv, mInfo)
.setWindowBounds(bounds)
.setUseTwoPanels(isTwoPanels)
- .setMultiWindowMode(isMultiWindowMode);
+ .setMultiWindowMode(isMultiWindowMode)
+ .setGestureMode(isGestureMode);
}
public DeviceProfile copy(Context context) {
@@ -1081,9 +1091,11 @@
writer.println(prefix + "\t1 dp = " + mMetrics.density + " px");
writer.println(prefix + "\tisTablet:" + isTablet);
+ writer.println(prefix + "\tisLargeTablet:" + isLargeTablet);
writer.println(prefix + "\tisPhone:" + isPhone);
writer.println(prefix + "\ttransposeLayoutWithOrientation:"
+ transposeLayoutWithOrientation);
+ writer.println(prefix + "\tisGestureMode:" + isGestureMode);
writer.println(prefix + "\tisLandscape:" + isLandscape);
writer.println(prefix + "\tisMultiWindowMode:" + isMultiWindowMode);
@@ -1266,6 +1278,7 @@
private boolean mIsMultiWindowMode = false;
private Boolean mTransposeLayoutWithOrientation;
+ private Boolean mIsGestureMode;
public Builder(Context context, InvariantDeviceProfile inv, Info info) {
mContext = context;
@@ -1294,6 +1307,11 @@
return this;
}
+ public Builder setGestureMode(boolean isGestureMode) {
+ mIsGestureMode = isGestureMode;
+ return this;
+ }
+
public DeviceProfile build() {
if (mWindowBounds == null) {
throw new IllegalArgumentException("Window bounds not set");
@@ -1301,8 +1319,11 @@
if (mTransposeLayoutWithOrientation == null) {
mTransposeLayoutWithOrientation = !mInfo.isTablet(mWindowBounds);
}
- return new DeviceProfile(mContext, mInv, mInfo, mWindowBounds,
- mIsMultiWindowMode, mTransposeLayoutWithOrientation, mUseTwoPanels);
+ if (mIsGestureMode == null) {
+ mIsGestureMode = DisplayController.getNavigationMode(mContext).hasGestures;
+ }
+ return new DeviceProfile(mContext, mInv, mInfo, mWindowBounds, mIsMultiWindowMode,
+ mTransposeLayoutWithOrientation, mUseTwoPanels, mIsGestureMode);
}
}