From 82fa92011b0f634d696309e13f63f1d544545e73 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 18 Mar 2016 17:25:11 -0700 Subject: [PATCH] Center folders slightly less aggressively than before -> Some slight changes in spacing showed that we were centering folders a bit too eagerly -> Once there is less than a ~4x delta between the spacing on the left vs. the right of the folder, center it. issue 27671587 Change-Id: Ic2861ab375d9b9e4cf0eeb28b683073246f35c97 --- src/com/android/launcher3/folder/Folder.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 76140fc339..9fdb29506d 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -1067,8 +1067,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList sTempRect.left + sTempRect.width() - width); int top = Math.min(Math.max(sTempRect.top, centeredTop), sTempRect.top + sTempRect.height() - height); - if (grid.isPhone && (grid.availableWidthPx - width) < grid.iconSizePx) { - // Center the folder if it is full (on phones only) + + int distFromEdgeOfScreen = grid.getWorkspacePadding(isLayoutRtl()).left + getPaddingLeft(); + + if (grid.isPhone && (grid.availableWidthPx - width) < 4 * distFromEdgeOfScreen) { + // Center the folder if it is very close to being centered anyway, by virtue of + // filling the majority of the viewport. ie. remove it from the uncanny valley + // of centeredness. left = (grid.availableWidthPx - width) / 2; } else if (width >= sTempRect.width()) { // If the folder doesn't fit within the bounds, center it about the desired bounds