Add undo snackbar for deleting items
- Add methods to ModelWriter to prepareForUndoDelete, then
enqueueDeleteRunnable, followed by commitDelete or abortDelete.
- Add Snackbar floating view
- Show Undo snackbar when dropping or flinging to delete target; if the
undo action is clicked, we abort the delete, otherwise we commit it.
Bug: 24238108
Change-Id: I9997235e1f8525cbb8b1fa2338099609e7358426
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index ed8c42d..dd63ebc 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -264,6 +264,10 @@
*/
@Override
public void onDrop(final DragObject d, final DragOptions options) {
+ if (options.isFlingToDelete) {
+ // FlingAnimation handles the animation and then calls completeDrop().
+ return;
+ }
final DragLayer dragLayer = mLauncher.getDragLayer();
final Rect from = new Rect();
dragLayer.getViewRectRelativeToSelf(d.dragView, from);