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
This commit is contained in:
Tony Wickham
2018-08-21 11:40:23 -07:00
parent 1654c9e1c0
commit 6a71a5bd77
21 changed files with 344 additions and 53 deletions

View File

@@ -264,6 +264,10 @@ public abstract class ButtonDropTarget extends TextView
*/
@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);