Shrink-wrapped folders

Change-Id: Ida1b5d0bd4d39eabfde9f8a5bee0d4b6e9b33627
This commit is contained in:
Adam Cohen
2011-05-13 20:57:39 -07:00
parent b3715fe227
commit 2801cafe62
19 changed files with 448 additions and 174 deletions

View File

@@ -42,6 +42,8 @@ public class DragLayer extends FrameLayout {
new ArrayList<AppWidgetResizeFrame>();
private AppWidgetResizeFrame mCurrentResizeFrame;
private int mXDown, mYDown;
private Folder mCurrentFolder = null;
private Launcher mLauncher;
/**
* Used to create a new DragLayer from XML.
@@ -82,6 +84,18 @@ public class DragLayer extends FrameLayout {
}
}
}
if (mCurrentFolder != null) {
mCurrentFolder.getHitRect(hitRect);
int[] screenPos = new int[2];
View parent = (View) mCurrentFolder.getParent();
if (parent != null) {
parent.getLocationOnScreen(screenPos);
hitRect.offset(screenPos[0], screenPos[1]);
if (!hitRect.contains(x, y)) {
mLauncher.closeFolder();
}
}
}
return false;
}
@@ -237,4 +251,12 @@ public class DragLayer extends FrameLayout {
resizeFrame.snapToWidget(false);
}
public void setLauncher(Launcher l) {
mLauncher = l;
}
public void setCurrentFolder(Folder f) {
mCurrentFolder = f;
}
}