Folders now close in various situations where we want them to:

-> When pressing home, from app or from home
-> When rotating (as per design request)
-> When scrolling to another page

Change-Id: I3b96b216f1ec5da07cd95d2541999866a1c1424e
This commit is contained in:
Adam Cohen committed 2011-07-04 23:56:03 -07:00
1 parent ec228e7fa3
commit 95bb800de9
3 files changed
+12 -29

No files matched your search

+1 -1
View File
@@ -648,7 +648,7 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
}
};
private void completeDragExit() {
public void completeDragExit() {
mLauncher.closeFolder();
mCurrentDragInfo = null;
mCurrentDragView = null;
+3 -28
View File
@@ -148,8 +148,6 @@ public final class Launcher extends Activity
private static final String RUNTIME_STATE_CURRENT_SCREEN = "launcher.current_screen";
// Type: int
private static final String RUNTIME_STATE = "launcher.state";
// Type: long
private static final String RUNTIME_STATE_FOLDERS = "launcher.folder";
// Type: int
private static final String RUNTIME_STATE_PENDING_ADD_SCREEN = "launcher.add_screen";
// Type: int
@@ -1266,6 +1264,8 @@ public final class Launcher extends Activity
// also will cancel mWaitingForResult.
closeSystemDialogs();
closeFolder();
boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
@@ -1300,15 +1300,7 @@ public final class Launcher extends Activity
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putInt(RUNTIME_STATE_CURRENT_SCREEN, mWorkspace.getCurrentPage());
final Folder folder = mWorkspace.getOpenFolder();
if (folder != null) {
long[] ids = new long[1];
ids[0] = folder.getInfo().id;
outState.putLongArray(RUNTIME_STATE_FOLDERS, ids);
} else {
super.onSaveInstanceState(outState);
}
super.onSaveInstanceState(outState);
outState.putInt(RUNTIME_STATE, mState.ordinal());
@@ -3096,23 +3088,6 @@ public final class Launcher extends Activity
if (!mWorkspace.hasFocus()) {
mWorkspace.getChildAt(mWorkspace.getCurrentPage()).requestFocus();
}
final long[] folders = mSavedState.getLongArray(RUNTIME_STATE_FOLDERS);
if (folders != null) {
for (long folderId : folders) {
final FolderInfo info = sFolders.get(folderId);
final FolderIcon folderIcon = (FolderIcon)
mWorkspace.getViewForTag(info);
if (folderIcon != null) {
openFolder(folderIcon);
}
}
final Folder openFolder = mWorkspace.getOpenFolder();
if (openFolder != null) {
openFolder.requestFocus();
}
}
mSavedState = null;
}
+8
View File
@@ -3025,6 +3025,10 @@ public class Workspace extends SmoothPagedView
if (!mIsSmall && !mIsInUnshrinkAnimation) {
super.scrollLeft();
}
Folder openFolder = getOpenFolder();
if (openFolder != null) {
openFolder.completeDragExit();
}
}
@Override
@@ -3032,6 +3036,10 @@ public class Workspace extends SmoothPagedView
if (!mIsSmall && !mIsInUnshrinkAnimation) {
super.scrollRight();
}
Folder openFolder = getOpenFolder();
if (openFolder != null) {
openFolder.completeDragExit();
}
}
@Override