diff options
author | Jonathan Miranda <jonmiranda@google.com> | 2017-07-20 22:06:54 +0000 |
---|---|---|
committer | Jonathan Miranda <jonmiranda@google.com> | 2017-07-20 22:06:54 +0000 |
commit | 55f2c457291d2283c7685fc41dedfc5d2bfad987 (patch) | |
tree | f31cfe011d89aa5fc772e2fa80b9d31b8d3d6e04 /src/com/android/launcher3 | |
parent | 70999fef4bc37bcf32556e2de23ec115dbd30cf8 (diff) | |
parent | fd8fa136f5cec15302bf48bdd60761e057f960c4 (diff) | |
download | android_packages_apps_Trebuchet-55f2c457291d2283c7685fc41dedfc5d2bfad987.tar.gz android_packages_apps_Trebuchet-55f2c457291d2283c7685fc41dedfc5d2bfad987.tar.bz2 android_packages_apps_Trebuchet-55f2c457291d2283c7685fc41dedfc5d2bfad987.zip |
Update Folders to match spec. am: fd8fa136f5
Change-Id: If10efb5a72bbe261f6e7af2b66e741b7a9ee350b
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 10 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderAnimationManager.java | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 2d5f8d016..38011eaa3 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -108,6 +108,7 @@ public class DeviceProfile { public int folderChildIconSizePx; public int folderChildTextSizePx; public int folderChildDrawablePaddingPx; + public final int folderChildDrawablePaddingOriginalPx; // Hotseat public int hotseatCellHeightPx; @@ -220,6 +221,9 @@ public class DeviceProfile { hotseatLandRightNavBarGutterPx = res.getDimensionPixelSize( R.dimen.dynamic_grid_hotseat_land_right_nav_bar_gutter_width); + folderChildDrawablePaddingOriginalPx = + res.getDimensionPixelSize(R.dimen.folder_child_icon_drawable_padding); + // Determine sizes. widthPx = width; heightPx = height; @@ -390,15 +394,15 @@ public class DeviceProfile { folderChildIconSizePx = (int) (Utilities.pxFromDp(inv.iconSize, dm) * scale); folderChildTextSizePx = (int) (res.getDimensionPixelSize(R.dimen.folder_child_text_size) * scale); + folderChildDrawablePaddingPx = (int) (folderChildDrawablePaddingOriginalPx * scale); int textHeight = Utilities.calculateTextHeight(folderChildTextSizePx); int cellPaddingX = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_x_padding) * scale); int cellPaddingY = (int) (res.getDimensionPixelSize(R.dimen.folder_cell_y_padding) * scale); folderCellWidthPx = folderChildIconSizePx + 2 * cellPaddingX; - folderCellHeightPx = folderChildIconSizePx + 2 * cellPaddingY + textHeight; - folderChildDrawablePaddingPx = Math.max(0, - (folderCellHeightPx - folderChildIconSizePx - textHeight) / 3); + folderCellHeightPx = folderChildIconSizePx + 2 * cellPaddingY + textHeight + + folderChildDrawablePaddingPx; } public void updateInsets(Rect insets) { diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java index 69705d594..d7f5c2b64 100644 --- a/src/com/android/launcher3/folder/FolderAnimationManager.java +++ b/src/com/android/launcher3/folder/FolderAnimationManager.java @@ -120,6 +120,7 @@ public class FolderAnimationManager { final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) mFolder.getLayoutParams(); FolderIcon.PreviewLayoutRule rule = mFolderIcon.getLayoutRule(); final List<BubbleTextView> itemsInPreview = mFolderIcon.getPreviewItems(); + BubbleTextView btv = itemsInPreview.get(0); // Match position of the FolderIcon final Rect folderIconPos = new Rect(); @@ -131,7 +132,7 @@ public class FolderAnimationManager { // Match size/scale of icons in the preview float previewScale = rule.scaleForItem(0, itemsInPreview.size()); float previewSize = rule.getIconSize() * previewScale; - float initialScale = previewSize / itemsInPreview.get(0).getIconSize() + float initialScale = previewSize / btv.getIconSize() * scaleRelativeToDragLayer; final float finalScale = 1f; float scale = mIsOpening ? initialScale : finalScale; @@ -148,10 +149,12 @@ public class FolderAnimationManager { previewItemOffsetX = (int) (lp.width * initialScale - initialSize - previewItemOffsetX); } + // Note that we do not include btv.getPaddingLeft() in the calculation, since it is + // handled in addPreviewItemAnimators as part of iconOffsetX. final int paddingOffsetX = (int) ((mFolder.getPaddingLeft() + mContent.getPaddingLeft()) * initialScale); - final int paddingOffsetY = (int) ((mFolder.getPaddingTop() + mContent.getPaddingTop()) - * initialScale); + final int paddingOffsetY = (int) ((mFolder.getPaddingTop() + mContent.getPaddingTop() + + btv.getPaddingTop()) * initialScale); int initialX = folderIconPos.left + mPreviewBackground.getOffsetX() - paddingOffsetX - previewItemOffsetX; |