From 1c8d90aed02f94659c1fecc1f6de6c0651ab1169 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Tue, 12 Nov 2019 17:54:58 -0800 Subject: [PATCH] Fix folder available height calculation Bug: 139456471 Test: Manual Change-Id: Ic86c481e76f8b6629ad74109ef98900f1c00e16c --- src/com/android/launcher3/DeviceProfile.java | 13 +++++++------ src/com/android/launcher3/folder/Folder.java | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index a35f598686..bc6fa6e903 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -403,14 +403,15 @@ public class DeviceProfile { Point totalWorkspacePadding = getTotalWorkspacePadding(); // Check if the icons fit within the available height. - float usedHeight = folderCellHeightPx * inv.numFolderRows + folderBottomPanelSize; - int maxHeight = availableHeightPx - totalWorkspacePadding.y - folderMargin; - float scaleY = maxHeight / usedHeight; + float contentUsedHeight = folderCellHeightPx * inv.numFolderRows; + int contentMaxHeight = availableHeightPx - totalWorkspacePadding.y - folderBottomPanelSize + - folderMargin; + float scaleY = contentMaxHeight / contentUsedHeight; // Check if the icons fit within the available width. - float usedWidth = folderCellWidthPx * inv.numFolderColumns; - int maxWidth = availableWidthPx - totalWorkspacePadding.x - folderMargin; - float scaleX = maxWidth / usedWidth; + float contentUsedWidth = folderCellWidthPx * inv.numFolderColumns; + int contentMaxWidth = availableWidthPx - totalWorkspacePadding.x - folderMargin; + float scaleX = contentMaxWidth / contentUsedWidth; float scale = Math.min(scaleX, scaleY); if (scale < 1f) { diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 22dda4140b..3ac73b3c8e 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -986,8 +986,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo private int getContentAreaHeight() { DeviceProfile grid = mLauncher.getDeviceProfile(); - int maxContentAreaHeight = grid.availableHeightPx - - grid.getTotalWorkspacePadding().y - mFooterHeight; + int maxContentAreaHeight = grid.availableHeightPx - grid.getTotalWorkspacePadding().y + - mFooterHeight; int height = Math.min(maxContentAreaHeight, mContent.getDesiredHeight()); return Math.max(height, MIN_CONTENT_DIMEN);