summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-08-23 12:55:10 -0700
committerWinson Chung <winsonc@google.com>2013-08-23 12:55:10 -0700
commit0e6a713fca3261021fcaca62c75dad8486c5e39f (patch)
treea981481f8b7983b1a9f5ae80110e646048954ba6 /src
parent892c74d460ad98c6306420e1127c9aa3e505ba25 (diff)
downloadandroid_packages_apps_Trebuchet-0e6a713fca3261021fcaca62c75dad8486c5e39f.tar.gz
android_packages_apps_Trebuchet-0e6a713fca3261021fcaca62c75dad8486c5e39f.tar.bz2
android_packages_apps_Trebuchet-0e6a713fca3261021fcaca62c75dad8486c5e39f.zip
Fixing issue where dragging final items out of hot seat folder can causes inconsistency issue.
- Fixing restoring of workspace screens on rotation (and flash of custom content page indicator) - Fixing NPE on long pressing on empty screen to go into overview mode
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Folder.java5
-rw-r--r--src/com/android/launcher3/Launcher.java31
-rw-r--r--src/com/android/launcher3/Workspace.java12
3 files changed, 33 insertions, 15 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 6308bb792..3aa91333c 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -1062,9 +1062,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mLauncher.removeFolder(mInfo);
}
// We add the child after removing the folder to prevent both from existing at
- // the same time in the CellLayout.
+ // the same time in the CellLayout. We need to add the new item with addInScreenFromBind()
+ // to ensure that hotseat items are placed correctly.
if (child != null) {
- mLauncher.getWorkspace().addInScreen(child, mInfo.container, mInfo.screenId,
+ mLauncher.getWorkspace().addInScreenFromBind(child, mInfo.container, mInfo.screenId,
mInfo.cellX, mInfo.cellY, mInfo.spanX, mInfo.spanY);
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 7fc7033fc..ce4a78c3f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2537,14 +2537,16 @@ public class Launcher extends Activity
boolean allowLongPress = isHotseatLayout(v) || mWorkspace.allowLongPress();
if (allowLongPress && !mDragController.isDragging()) {
if (itemUnderLongClick == null) {
- // User long pressed on empty space
- mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- // Disabling reordering until we sort out some issues.
- if (mWorkspace.isInOverviewMode()) {
- mWorkspace.startReordering(v);
- } else {
- mWorkspace.enterOverviewMode();
+ if (mWorkspace.hasNonCustomEmptyScreens()) {
+ // User long pressed on empty space
+ mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
+ // Disabling reordering until we sort out some issues.
+ if (mWorkspace.isInOverviewMode()) {
+ mWorkspace.startReordering(v);
+ } else {
+ mWorkspace.enterOverviewMode();
+ }
}
} else {
if (!(itemUnderLongClick instanceof Folder)) {
@@ -3502,7 +3504,15 @@ public class Launcher extends Activity
@Override
public void bindScreens(ArrayList<Long> orderedScreenIds) {
bindAddScreens(orderedScreenIds);
+
+ // Create the new empty page
mWorkspace.addExtraEmptyScreen();
+
+ // Create the custom content page (this call updates mDefaultScreen which calls
+ // setCurrentPage() so ensure that all pages are added before calling this)
+ if (!mWorkspace.hasCustomContent() && hasCustomContentToLeft()) {
+ mWorkspace.createCustomContentPage();
+ }
}
@Override
@@ -3744,11 +3754,6 @@ public class Launcher extends Activity
mSavedState = null;
}
- // Create the custom content page here before onLayout to prevent flashing
- if (!mWorkspace.hasCustomContent() && hasCustomContentToLeft()) {
- mWorkspace.createCustomContentPage();
- }
-
mWorkspace.restoreInstanceStateForRemainingPages();
// If we received the result of any pending adds while the loader was running (e.g. the
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index ba18b8de7..d33e65041 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -567,6 +567,18 @@ public class Workspace extends SmoothPagedView
return -1;
}
+ public boolean hasNonCustomEmptyScreens() {
+ Log.w(TAG, "10249126 - hasNonCustomEmptyScreens()");
+ Iterator<Long> iter = mWorkspaceScreens.keySet().iterator();
+ while (iter.hasNext()) {
+ long id = iter.next();
+ if (id >= 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
ArrayList<Long> getScreenOrder() {
return mScreenOrder;
}