Polish folder icon bugs.
- Fix bug where folders are misaligned.
- Fix bug when closing on 2nd page of large folder.
Bug: 184822585
Test: drag folder originally in hotseat to workspace, vice versa
test on grid where isScalable=true and isScalable=false
Change-Id: I08a79b8d280df3e3974baaa07e80db6bc4165e58
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index bfa1769..3823437 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -684,9 +684,6 @@
if (child instanceof BubbleTextView) {
BubbleTextView bubbleChild = (BubbleTextView) child;
bubbleChild.setTextVisibility(mContainerType != HOTSEAT);
- if (mActivity.getDeviceProfile().isScalableGrid) {
- bubbleChild.setCenterVertically(mContainerType != HOTSEAT);
- }
}
child.setScaleX(mChildScale);
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 4579705..2a5187d 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -138,12 +138,14 @@
mBorderSpacing, null);
// Center the icon/folder
int cHeight = getCellContentHeight();
- int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
+ int cellPaddingY = dp.isScalableGrid && mContainerType == WORKSPACE
+ ? dp.cellYPaddingPx
+ : (int) Math.max(0, ((lp.height - cHeight) / 2f));
// No need to add padding when cell layout border spacing is present.
- boolean noPadding = (dp.cellLayoutBorderSpacingPx > 0 && mContainerType == WORKSPACE)
+ boolean noPaddingX = (dp.cellLayoutBorderSpacingPx > 0 && mContainerType == WORKSPACE)
|| (dp.folderCellLayoutBorderSpacingPx > 0 && mContainerType == FOLDER);
- int cellPaddingX = noPadding
+ int cellPaddingX = noPaddingX
? 0
: mContainerType == WORKSPACE
? dp.workspaceCellPaddingXPx
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 4fe85be..cb3884d 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -245,9 +245,8 @@
+ mDeviceProfile.folderCellHeightPx * 2;
int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage();
int left = mContent.getPaddingLeft() + page * lp.width;
- Rect contentStart = new Rect(0, 0, width, height);
- Rect contentEnd = new Rect(endRect.left + left, endRect.top, endRect.right + left,
- endRect.bottom);
+ Rect contentStart = new Rect(left, 0, left + width, height);
+ Rect contentEnd = new Rect(left, 0, left + lp.width, lp.height);
play(a, getShape().createRevealAnimator(
mFolder.getContent(), contentStart, contentEnd, finalRadius, !mIsOpening));
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index 5c11451..25a0141 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -174,8 +174,6 @@
folder.setFolderIcon(icon);
folder.bind(folderInfo);
icon.setFolder(folder);
- icon.mBackground.paddingY = icon.isInHotseat()
- ? 0 : activityContext.getDeviceProfile().cellYPaddingPx;
return icon;
}
@@ -217,7 +215,6 @@
icon.setAccessibilityDelegate(activity.getAccessibilityDelegate());
- icon.mBackground.paddingY = icon.isInHotseat() ? 0 : grid.cellYPaddingPx;
icon.mPreviewVerifier = new FolderGridOrganizer(activity.getDeviceProfile().inv);
icon.mPreviewVerifier.setFolderInfo(folderInfo);
icon.updatePreviewItems(false);
@@ -580,7 +577,6 @@
public void setFolderBackground(PreviewBackground bg) {
mBackground = bg;
mBackground.setInvalidateDelegate(this);
- mBackground.paddingY = isInHotseat() ? 0 : mActivity.getDeviceProfile().cellYPaddingPx;
}
@Override
@@ -628,7 +624,6 @@
if (!mForceHideDot && ((mDotInfo != null && mDotInfo.hasDot()) || mDotScale > 0)) {
Rect iconBounds = mDotParams.iconBounds;
BubbleTextView.getIconBounds(this, iconBounds, mActivity.getDeviceProfile().iconSizePx);
- iconBounds.offset(0, mBackground.paddingY);
float iconScale = (float) mBackground.previewSize / iconBounds.width();
Utilities.scaleRectAboutCenter(iconBounds, iconScale);
diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java
index 204decb..460521f 100644
--- a/src/com/android/launcher3/folder/PreviewBackground.java
+++ b/src/com/android/launcher3/folder/PreviewBackground.java
@@ -77,7 +77,6 @@
int previewSize;
int basePreviewOffsetX;
int basePreviewOffsetY;
- int paddingY;
private CellLayout mDrawingDelegate;
@@ -161,7 +160,7 @@
previewSize = grid.folderIconSizePx;
basePreviewOffsetX = (availableSpaceX - previewSize) / 2;
- basePreviewOffsetY = paddingY + topPadding + grid.folderIconOffsetYPx;
+ basePreviewOffsetY = topPadding + grid.folderIconOffsetYPx;
// Stroke width is 1dp
mStrokeWidth = context.getResources().getDisplayMetrics().density;