diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 35598a2f24..ac41a2bd7b 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -113,6 +113,7 @@ public class CellLayout extends ViewGroup { // If we're actively dragging something over this screen, mIsDragOverlapping is true private boolean mIsDragOverlapping = false; private final Point mDragCenter = new Point(); + boolean mUseActiveGlowBackground = false; // These arrays are used to implement the drag visualization on x-large screens. // They are used as circular arrays, indexed by mDragOutlineCurrent. @@ -383,10 +384,15 @@ public class CellLayout extends ViewGroup { void setIsDragOverlapping(boolean isDragOverlapping) { if (mIsDragOverlapping != isDragOverlapping) { mIsDragOverlapping = isDragOverlapping; + setUseActiveGlowBackground(mIsDragOverlapping); invalidate(); } } + void setUseActiveGlowBackground(boolean use) { + mUseActiveGlowBackground = use; + } + boolean getIsDragOverlapping() { return mIsDragOverlapping; } @@ -437,7 +443,7 @@ public class CellLayout extends ViewGroup { if (mBackgroundAlpha > 0.0f) { Drawable bg; - if (mIsDragOverlapping) { + if (mUseActiveGlowBackground) { // In the mini case, we draw the active_glow bg *over* the active background bg = mActiveGlowBackground; } else { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index e059feebfe..d1959dfec5 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2432,9 +2432,11 @@ public class Launcher extends Activity mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); // Disabling reordering until we sort out some issues. - //mWorkspace.startReordering(); - // TODO: need to have a new way to set wallpaper or start reordering - startWallpaper(); + if (mWorkspace.getIdForScreen((CellLayout) v) >= 0) { + mWorkspace.startReordering(); + } else { + startWallpaper(); + } } else { if (!(itemUnderLongClick instanceof Folder)) { // User long pressed on an item diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index c2b9bd7bca..cc9a075828 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -87,7 +87,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc // We are disabling touch interaction of the widget region for factory ROM. private static final boolean DISABLE_TOUCH_INTERACTION = false; private static final boolean DISABLE_TOUCH_SIDE_PAGES = false; - private static final boolean DISABLE_FLING_TO_DELETE = false; + private static final boolean DISABLE_FLING_TO_DELETE = true; static final int AUTOMATIC_PAGE_SPACING = -1; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 37ef3c4377..cd31722d7f 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -650,10 +650,9 @@ public class Workspace extends SmoothPagedView return; } } - - // If an item is added to the extra empty screen, we convert it to a real if (screenId == EXTRA_EMPTY_SCREEN_ID) { - screenId = commitExtraEmptyScreen(); + // This should never happen + throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID"); } final CellLayout layout; @@ -1666,6 +1665,49 @@ public class Workspace extends SmoothPagedView return getChangeStateAnimation(state, animated, 0); } + void boundByReorderablePages(boolean isReordering, int[] range) { + int count = mScreenOrder.size(); + + int start = -1; + int end = -1; + // + for (int i = 0; i < count; i++) { + if (start < 0 && mScreenOrder.get(i) >= 0) { + start = i; + } + if (start >=0 && mScreenOrder.get(i) >= 0) { + end = i; + } + } + range[0] = start; + range[1] = end; + } + + protected void onStartReordering() { + super.onStartReordering(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + ((CellLayout) getChildAt(i)).setUseActiveGlowBackground(true); + } + showOutlines(); + } + + protected void onEndReordering() { + super.onEndReordering(); + int count = getChildCount(); + for (int i = 0; i < count; i++) { + ((CellLayout) getChildAt(i)).setUseActiveGlowBackground(false); + } + hideOutlines(); + + mScreenOrder.clear(); + for (int i = 0; i < count; i++) { + CellLayout cl = ((CellLayout) getChildAt(i)); + mScreenOrder.add(getIdForScreen(cl)); + } + mLauncher.getModel().updateWorkspaceScreenOrder(mLauncher, mScreenOrder); + } + Animator getChangeStateAnimation(final State state, boolean animated, int delay) { if (mState == state) { return null; @@ -2113,6 +2155,12 @@ public class Workspace extends SmoothPagedView return false; } } + + long screenId = getIdForScreen(dropTargetLayout); + if (screenId == EXTRA_EMPTY_SCREEN_ID) { + commitExtraEmptyScreen(); + } + return true; }