summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-03-14 14:08:12 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-03-15 09:44:49 -0700
commit44d0b5355d2dd39f6d1b0349bc3685ec4573a04a (patch)
tree888fd19e997fde3cd6cdbc4c52c86f4f25247994
parent0da3bc6cfbd4de056e15100a0e2b2bc9e85a5d73 (diff)
downloadandroid_packages_apps_Trebuchet-44d0b5355d2dd39f6d1b0349bc3685ec4573a04a.tar.gz
android_packages_apps_Trebuchet-44d0b5355d2dd39f6d1b0349bc3685ec4573a04a.tar.bz2
android_packages_apps_Trebuchet-44d0b5355d2dd39f6d1b0349bc3685ec4573a04a.zip
Closing folder in onSaveInstanceState
folderInfo.isOpened is part of static model, where is the open folder state is part of the UI. This resets the static model, when the UI is about to be reset This also causes the folders to get closed when launcher gets hidden Partial revert of: Ie1318b82b497957b99603b11ec338dd50d51b962 Bug: 27596291, 24900496, 27624924 Change-Id: I30c2bb99a19fdd95a1b997d07066f80be812e2c0
-rw-r--r--src/com/android/launcher3/Launcher.java29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c8eb9cc56..e41152752 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -184,8 +184,6 @@ public 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_OPEN_FOLDER_ID = "launcher.open_folder_id";
// Type: Content Values / parcelable
private static final String RUNTIME_STATE_PENDING_ADD_ITEM = "launcher.add_item";
// Type: parcelable
@@ -1956,10 +1954,10 @@ public class Launcher extends Activity
super.onSaveInstanceState(outState);
outState.putInt(RUNTIME_STATE, mState.ordinal());
- Folder openFolder = mWorkspace.getOpenFolder();
- if (openFolder != null) {
- outState.putLong(RUNTIME_STATE_OPEN_FOLDER_ID, openFolder.mInfo.id);
- }
+ // We close any open folder since it will not be re-opened, and we need to make sure
+ // this state is reflected.
+ // TODO: Move folderInfo.isOpened out of the model and make it a UI state.
+ closeFolder(false);
if (mPendingAddInfo.container != ItemInfo.NO_ID && mPendingAddInfo.screenId > -1 &&
mWaitingForResult) {
@@ -4148,25 +4146,6 @@ public class Launcher extends Activity
mWorkspace.getChildAt(mWorkspace.getCurrentPage()).requestFocus();
}
- long folderId = mSavedState.getLong(RUNTIME_STATE_OPEN_FOLDER_ID);
- if (folderId != 0) {
- View view = mWorkspace.getHomescreenIconByItemId(folderId);
- if (view instanceof FolderIcon) {
- FolderIcon icon = (FolderIcon) view;
- FolderInfo info = icon.getFolderInfo();
- long currentScreenId = mWorkspace.getScreenIdForPageIndex(
- mWorkspace.getNextPage());
- if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT
- || info.screenId == currentScreenId) {
- // We can show the folder
- openFolder(icon, false);
- } else {
- Launcher.addDumpLog(TAG, "Saved state contains folder " + info +
- " but current screen is " + currentScreenId);
- }
- }
- }
-
mSavedState = null;
}