summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Workspace.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-10-05 09:05:42 -0700
committerTony Wickham <twickham@google.com>2016-11-02 15:07:57 -0700
commitea62fe0be19c54f8fbb434c6334418b96626f70d (patch)
treef9d9c9794f37f8f60e9eb8c1f6ee79e4bb53a005 /src/com/android/launcher3/Workspace.java
parentdf3bc52ca9c4271398d35b17cf550ca9099b8249 (diff)
downloadandroid_packages_apps_Trebuchet-ea62fe0be19c54f8fbb434c6334418b96626f70d.tar.gz
android_packages_apps_Trebuchet-ea62fe0be19c54f8fbb434c6334418b96626f70d.tar.bz2
android_packages_apps_Trebuchet-ea62fe0be19c54f8fbb434c6334418b96626f70d.zip
Animate icons back to where they were picked up.
We do this for pre-dragged icons instead of calling onDrop(). - Removes need for special logic in onDrop() to check if mIsInPreDrag - Dropping from pre-drag in all apps also animates instead of jumping We also do this when dropping an icon while still transitioning to spring-loaded mode, to avoid having a janky jump at the end - Bug: 27135377 Change-Id: I4548c3e2fef3423d1ba36057fb53807b1b4ad0fc
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r--src/com/android/launcher3/Workspace.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 2161e3970..016079de2 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2528,6 +2528,7 @@ public class Workspace extends PagedView
onDropExternal(touchXY, d.dragInfo, dropTargetLayout, false, d);
} else if (mDragInfo != null) {
final View cell = mDragInfo.cell;
+ boolean droppedOnOriginalCellDuringTransition = false;
if (dropTargetLayout != null && !d.cancelled) {
// Move internally
@@ -2570,6 +2571,10 @@ public class Workspace extends PagedView
minSpanY = item.minSpanY;
}
+ droppedOnOriginalCellDuringTransition = mIsSwitchingState
+ && item.screenId == screenId && item.container == container
+ && item.cellX == mTargetCell[0] && item.cellY == mTargetCell[1];
+
int[] resultSpan = new int[2];
mTargetCell = dropTargetLayout.performReorder((int) mDragViewVisualCenter[0],
(int) mDragViewVisualCenter[1], minSpanX, minSpanY, spanX, spanY, cell,
@@ -2627,7 +2632,7 @@ public class Workspace extends PagedView
&& !d.accessibleDrag) {
mDelayedResizeRunnable = new Runnable() {
public void run() {
- if (!isPageInTransition() && !mIsSwitchingState) {
+ if (!isPageInTransition()) {
DragLayer dragLayer = mLauncher.getDragLayer();
dragLayer.addResizeFrame(hostView, cellLayout);
}
@@ -2662,6 +2667,17 @@ public class Workspace extends PagedView
};
mAnimatingViewIntoPlace = true;
if (d.dragView.hasDrawn()) {
+ if (droppedOnOriginalCellDuringTransition) {
+ // Animate the item to its original position, while simultaneously exiting
+ // spring-loaded mode so the page meets the icon where it was picked up.
+ mLauncher.getDragController().animateDragViewToOriginalPosition(
+ mDelayedResizeRunnable, cell,
+ mStateTransitionAnimation.mSpringLoadedTransitionTime);
+ mLauncher.exitSpringLoadedDragMode();
+ mLauncher.getDropTargetBar().onDragEnd();
+ parent.onDropChild(cell);
+ return;
+ }
final ItemInfo info = (ItemInfo) cell.getTag();
boolean isWidget = info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET
|| info.itemType == LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;