summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Folder.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-09-18 18:26:31 -0700
committerWinson Chung <winsonc@google.com>2013-09-20 17:22:05 -0700
commitaf40f205d7f0c5f73a92ff5d9b8e9602dbde58c0 (patch)
tree0f36e6018c23e408c1dd846a9ef5ce063478fb65 /src/com/android/launcher3/Folder.java
parent477828cc83b60a17eb9b6fc8ee08b4abbc3d2fb1 (diff)
downloadandroid_packages_apps_Trebuchet-af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0.tar.gz
android_packages_apps_Trebuchet-af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0.tar.bz2
android_packages_apps_Trebuchet-af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0.zip
Initial changes to restore clings.
Change-Id: Ie23e6e9f39679e8d35955a4a7db804d03f8b4d3f
Diffstat (limited to 'src/com/android/launcher3/Folder.java')
-rw-r--r--src/com/android/launcher3/Folder.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 47fc6c3f4..9ee3f6454 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -453,6 +453,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Cling cling = mLauncher.showFirstRunFoldersCling();
if (cling != null) {
cling.bringToFront();
+ bringToFront();
}
setFocusOnFirstChild();
}
@@ -878,11 +879,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+
int centerX = (int) (mTempRect.left + mTempRect.width() * scale / 2);
int centerY = (int) (mTempRect.top + mTempRect.height() * scale / 2);
int centeredLeft = centerX - width / 2;
int centeredTop = centerY - height / 2;
-
int currentPage = mLauncher.getWorkspace().getCurrentPage();
// In case the workspace is scrolling, we need to use the final scroll to compute
// the folders bounds.
@@ -900,8 +903,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
bounds.left + bounds.width() - width);
int top = Math.min(Math.max(bounds.top, centeredTop),
bounds.top + bounds.height() - height);
- // If the folder doesn't fit within the bounds, center it about the desired bounds
- if (width >= bounds.width()) {
+ if (grid.isPhone() && (grid.availableWidthPx - width) < grid.iconSizePx) {
+ // Center the folder if it is full (on phones only)
+ left = (grid.availableWidthPx - width) / 2;
+ } else if (width >= bounds.width()) {
+ // If the folder doesn't fit within the bounds, center it about the desired bounds
left = bounds.left + (bounds.width() - width) / 2;
}
if (height >= bounds.height()) {