resolve merge conflicts of 46378eb881 to sc-v2-dev

Folder icon polish.

- Increase the overlap between the preview items and the background
  so that it appears more intentional (lots of reports of users
  thinking that its a bug)
- Fix bug where clip path was still clipping icons when
  dragging and swiping to home.

Bug: 194339057
Bug: 193701705
Bug: 191225536
Test: test 2 icon, 3 icon, and 4 icon folders
      close folder on 2nd page, ensure clipping
      ensure no preview items are clipped in drag view
      ensure no preview items are clipped in swipe up to home
      test 2x2, 3x3, 4x4, 4x5, and 5x5 grids to ensure no clipping
      of folder icons
      drag and drop folder in and out of hotseat
      create folders (2 icon, 3 icon, 4 icon)

Change-Id: I09ce9ef59e340b1009de3d26eed430a0a8dc4b33
Merged-In: Id49bae33438e10248bef05450d7e2c92c2140748
This commit is contained in:
Jonathan Miranda
2021-07-22 00:38:43 +00:00
6 changed files with 39 additions and 14 deletions

View File

@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static com.android.launcher3.ResourceUtils.pxFromDp;
import static com.android.launcher3.Utilities.dpiFromPx;
import static com.android.launcher3.Utilities.pxFromSp;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR;
import static com.android.launcher3.util.WindowManagerCompat.MIN_TABLET_WIDTH;
import android.annotation.SuppressLint;
@@ -399,7 +400,8 @@ public class DeviceProfile {
}
private void updateHotseatIconSize(int hotseatIconSizePx) {
hotseatCellHeightPx = hotseatIconSizePx;
// Ensure there is enough space for folder icons, which have a slightly larger radius.
hotseatCellHeightPx = (int) Math.ceil(hotseatIconSizePx * ICON_OVERLAP_FACTOR);
if (isVerticalBarLayout()) {
hotseatBarSizePx = hotseatIconSizePx + hotseatBarSidePaddingStartPx
+ hotseatBarSidePaddingEndPx;
@@ -478,7 +480,7 @@ public class DeviceProfile {
if (workspaceCellPaddingY < iconTextHeight) {
iconTextSizePx = 0;
iconDrawablePaddingPx = 0;
cellHeightPx = iconSizePx;
cellHeightPx = (int) Math.ceil(iconSizePx * ICON_OVERLAP_FACTOR);
autoResizeAllAppsCells();
}
}
@@ -565,7 +567,8 @@ public class DeviceProfile {
desiredWorkspaceLeftRightMarginPx = (int) (desiredWorkspaceLeftRightOriginalPx * scale);
} else {
cellWidthPx = iconSizePx + iconDrawablePaddingPx;
cellHeightPx = iconSizePx + iconDrawablePaddingPx
cellHeightPx = (int) Math.ceil(iconSizePx * ICON_OVERLAP_FACTOR)
+ iconDrawablePaddingPx
+ Utilities.calculateTextHeight(iconTextSizePx);
int cellPaddingY = (getCellSize().y - cellHeightPx) / 2;
if (iconDrawablePaddingPx > cellPaddingY && !isVerticalLayout
@@ -824,9 +827,9 @@ public class DeviceProfile {
? workspacePadding.bottom
: hotseatBarSizePx - hotseatCellHeightPx - hotseatQsbHeight;
if (isScalableGrid && qsbBottomMarginPx <= freeSpace) {
return qsbBottomMarginPx;
} else {
if (isScalableGrid) {
return Math.min(qsbBottomMarginPx, freeSpace);
} else {
return (int) (freeSpace * QSB_CENTER_FACTOR)
+ (isTaskbarPresent ? taskbarSize : getInsets().bottom);
}
@@ -899,14 +902,16 @@ public class DeviceProfile {
return isVerticalBarLayout();
}
public int getCellHeight(@ContainerType int containerType) {
public int getCellContentHeight(@ContainerType int containerType) {
switch (containerType) {
case CellLayout.WORKSPACE:
return cellHeightPx;
case CellLayout.FOLDER:
return folderCellHeightPx;
case CellLayout.HOTSEAT:
return hotseatCellHeightPx;
// The hotseat is the only container where the cell height is going to be
// different from the content within that cell.
return iconSizePx;
default:
// ??
return 0;