Fix workspace and hotseat paddings for responsive grid in landscape
Add paddings for workspace and hotseat when vertical bar is enabled. Fix: 294033018 Flag: ENABLE_RESPONSIVE_WORKSPACE Test: DeviceProfileDumpTest Test: DeviceProfileAlternativeGridDumpTest Test: DeviceProfileResponsiveDumpTest Test: DeviceProfileResponsiveAlternativeDisplaysDumpTest Change-Id: I7358d2eb7b7c53b436756c21bd81d4746ea01801
This commit is contained in:
1 parent
087990668b
commit
3646a1b7e1
2 files changed
+81
-34
No files matched your search
@@ -618,6 +618,10 @@ public class DeviceProfile {
|
||||
// Hotseat and QSB width depends on updated cellSize and workspace padding
|
||||
recalculateHotseatWidthAndBorderSpace();
|
||||
|
||||
if (mIsResponsiveGrid && isVerticalBarLayout()) {
|
||||
hotseatBorderSpace = cellLayoutBorderSpacePx.y;
|
||||
}
|
||||
|
||||
// AllApps height calculation depends on updated cellSize
|
||||
if (isTablet) {
|
||||
int collapseHandleHeight =
|
||||
@@ -717,7 +721,7 @@ public class DeviceProfile {
|
||||
/** Updates hotseatCellHeightPx and hotseatBarSizePx */
|
||||
private void updateHotseatSizes(int hotseatIconSizePx) {
|
||||
// Ensure there is enough space for folder icons, which have a slightly larger radius.
|
||||
hotseatCellHeightPx = (int) Math.ceil(hotseatIconSizePx * ICON_OVERLAP_FACTOR);
|
||||
hotseatCellHeightPx = getIconSizeWithOverlap(hotseatIconSizePx);
|
||||
|
||||
if (isVerticalBarLayout()) {
|
||||
hotseatBarSizePx = hotseatIconSizePx + hotseatBarSidePaddingStartPx
|
||||
@@ -783,7 +787,6 @@ public class DeviceProfile {
|
||||
hotseatBorderSpace = calculateHotseatBorderSpace(maxHotseatIconsWidthPx,
|
||||
(isQsbInline ? 1 : 0) + /* border between nav buttons and first icon */ 1);
|
||||
} while (hotseatBorderSpace < mMinHotseatIconSpacePx && numShownHotseatIcons > 1);
|
||||
|
||||
}
|
||||
|
||||
private Point getCellLayoutBorderSpace(InvariantDeviceProfile idp) {
|
||||
@@ -866,11 +869,24 @@ public class DeviceProfile {
|
||||
float workspaceCellPaddingY = getCellSize().y - iconSizePx - iconDrawablePaddingPx
|
||||
- iconTextHeight;
|
||||
|
||||
if (mIsResponsiveGrid) {
|
||||
// Hide text only if doesn't fit inside the cell for responsive grid
|
||||
if (workspaceCellPaddingY < 0) {
|
||||
iconTextSizePx = 0;
|
||||
iconDrawablePaddingPx = 0;
|
||||
int iconSizeWithOverlap = getIconSizeWithOverlap(iconSizePx);
|
||||
cellYPaddingPx = Math.max(0, getCellSize().y - iconSizeWithOverlap) / 2;
|
||||
autoResizeAllAppsCells();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// We want enough space so that the text is closer to its corresponding icon.
|
||||
if (workspaceCellPaddingY < iconTextHeight) {
|
||||
iconTextSizePx = 0;
|
||||
iconDrawablePaddingPx = 0;
|
||||
cellHeightPx = (int) Math.ceil(iconSizePx * ICON_OVERLAP_FACTOR);
|
||||
cellHeightPx = getIconSizeWithOverlap(iconSizePx);
|
||||
autoResizeAllAppsCells();
|
||||
}
|
||||
}
|
||||
@@ -950,6 +966,10 @@ public class DeviceProfile {
|
||||
return Math.max(0, drawablePadding - iconSizeDiff / 2);
|
||||
}
|
||||
|
||||
private int getIconSizeWithOverlap(int iconSize) {
|
||||
return (int) Math.ceil(iconSize * ICON_OVERLAP_FACTOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updating the iconSize affects many aspects of the launcher layout, such as: iconSizePx,
|
||||
* iconTextSizePx, iconDrawablePaddingPx, cellWidth/Height, allApps* variants,
|
||||
@@ -1052,7 +1072,7 @@ public class DeviceProfile {
|
||||
} else {
|
||||
iconDrawablePaddingPx = (int) (getNormalizedIconDrawablePadding() * iconScale);
|
||||
cellWidthPx = iconSizePx + iconDrawablePaddingPx;
|
||||
cellHeightPx = (int) Math.ceil(iconSizePx * ICON_OVERLAP_FACTOR)
|
||||
cellHeightPx = getIconSizeWithOverlap(iconSizePx)
|
||||
+ iconDrawablePaddingPx
|
||||
+ Utilities.calculateTextHeight(iconTextSizePx);
|
||||
int cellPaddingY = (getCellSize().y - cellHeightPx) / 2;
|
||||
@@ -1107,7 +1127,6 @@ public class DeviceProfile {
|
||||
return Math.min(hotseatBorderSpacePx, mMaxHotseatIconSpacePx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the iconSize for allApps* variants.
|
||||
*/
|
||||
@@ -1455,14 +1474,26 @@ public class DeviceProfile {
|
||||
private void updateWorkspacePadding() {
|
||||
Rect padding = workspacePadding;
|
||||
if (isVerticalBarLayout()) {
|
||||
padding.top = 0;
|
||||
padding.bottom = edgeMarginPx;
|
||||
if (isSeascape()) {
|
||||
padding.left = hotseatBarSizePx;
|
||||
padding.right = hotseatBarSidePaddingStartPx;
|
||||
if (mIsResponsiveGrid) {
|
||||
padding.top = mResponsiveHeightSpec.getStartPaddingPx();
|
||||
padding.bottom = mResponsiveHeightSpec.getEndPaddingPx();
|
||||
if (isSeascape()) {
|
||||
padding.left = hotseatBarSizePx + mResponsiveWidthSpec.getEndPaddingPx();
|
||||
padding.right = mResponsiveWidthSpec.getStartPaddingPx();
|
||||
} else {
|
||||
padding.left = mResponsiveWidthSpec.getStartPaddingPx();
|
||||
padding.right = hotseatBarSizePx + mResponsiveWidthSpec.getEndPaddingPx();
|
||||
}
|
||||
} else {
|
||||
padding.left = hotseatBarSidePaddingStartPx;
|
||||
padding.right = hotseatBarSizePx;
|
||||
padding.top = 0;
|
||||
padding.bottom = edgeMarginPx;
|
||||
if (isSeascape()) {
|
||||
padding.left = hotseatBarSizePx;
|
||||
padding.right = hotseatBarSidePaddingStartPx;
|
||||
} else {
|
||||
padding.left = hotseatBarSidePaddingStartPx;
|
||||
padding.right = hotseatBarSizePx;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Pad the bottom of the workspace with hotseat bar
|
||||
@@ -1505,7 +1536,9 @@ public class DeviceProfile {
|
||||
// in vertical bar layout.
|
||||
// Workspace icons are moved up by a small factor. The variable diffOverlapFactor
|
||||
// is set to account for that difference.
|
||||
float diffOverlapFactor = iconSizePx * (ICON_OVERLAP_FACTOR - 1) / 2;
|
||||
float diffOverlapFactor = mIsResponsiveGrid ? 0
|
||||
: iconSizePx * (ICON_OVERLAP_FACTOR - 1) / 2;
|
||||
|
||||
int paddingTop = Math.max((int) (mInsets.top + cellLayoutPaddingPx.top
|
||||
- diffOverlapFactor), 0);
|
||||
int paddingBottom = Math.max((int) (mInsets.bottom + cellLayoutPaddingPx.bottom
|
||||
|
||||
Reference in new issue
Block a user