Merge "Animate icons back to where they were picked up." into ub-launcher3-master

This commit is contained in:
Tony Wickham
2016-11-15 19:53:32 +00:00
committed by Android (Google) Code Review
4 changed files with 53 additions and 26 deletions
+17 -1
View File
@@ -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;