Launcher shortcuts animations update.
> The shortcut container closes with an animation
> When opening/closing the animation only the icon scales
and not the title and drag handle
> When dragging the icon, it starts from the original icon position and
moves under the user finger. The container grows to follow the drag view.
Bug: 28980830
Change-Id: Ic0353c30b682d1f018cbf4d62e8a6e8e7d7d4664
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3f12abf..d668d2a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1864,7 +1864,7 @@
mWorkspace.exitWidgetResizeMode();
closeFolder(alreadyOnHome);
- closeShortcutsContainer();
+ closeShortcutsContainer(alreadyOnHome);
exitSpringLoadedDragMode();
// If we are already on home, then just animate back to the workspace,
@@ -1951,8 +1951,7 @@
// this state is reflected.
// TODO: Move folderInfo.isOpened out of the model and make it a UI state.
closeFolder(false);
-
- closeShortcutsContainer();
+ closeShortcutsContainer(false);
if (mPendingAddInfo.container != ItemInfo.NO_ID && mPendingAddInfo.screenId > -1 &&
mWaitingForResult) {
@@ -3130,11 +3129,17 @@
}
public void closeShortcutsContainer() {
+ closeShortcutsContainer(true);
+ }
+
+ public void closeShortcutsContainer(boolean animate) {
DeepShortcutsContainer deepShortcutsContainer = getOpenShortcutsContainer();
if (deepShortcutsContainer != null) {
- deepShortcutsContainer.cleanupDeferredDrag(true);
- mDragController.removeDragListener(deepShortcutsContainer);
- mDragLayer.removeView(deepShortcutsContainer);
+ if (animate) {
+ deepShortcutsContainer.animateClose();
+ } else {
+ deepShortcutsContainer.close();
+ }
}
}
@@ -3146,7 +3151,8 @@
// and will be one of the last views.
for (int i = mDragLayer.getChildCount() - 1; i >= 0; i--) {
View child = mDragLayer.getChildAt(i);
- if (child instanceof DeepShortcutsContainer) {
+ if (child instanceof DeepShortcutsContainer
+ && ((DeepShortcutsContainer) child).isOpen()) {
return (DeepShortcutsContainer) child;
}
}