summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/folder
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2016-03-18 17:25:11 -0700
committerAdam Cohen <adamcohen@google.com>2016-03-18 17:42:48 -0700
commit82fa92011b0f634d696309e13f63f1d544545e73 (patch)
tree84db7874aad5f2e60886c6a04ebb33349f41d6eb /src/com/android/launcher3/folder
parent3bbbabc54ac73a4451b0a862a3faac6426b1b7b4 (diff)
downloadandroid_packages_apps_Trebuchet-82fa92011b0f634d696309e13f63f1d544545e73.tar.gz
android_packages_apps_Trebuchet-82fa92011b0f634d696309e13f63f1d544545e73.tar.bz2
android_packages_apps_Trebuchet-82fa92011b0f634d696309e13f63f1d544545e73.zip
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
Diffstat (limited to 'src/com/android/launcher3/folder')
-rw-r--r--src/com/android/launcher3/folder/Folder.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 76140fc33..9fdb29506 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