title: CursorAdapter backed ListView delete animation "flickers" on delete
body: <p>I'm trying to implement swipe to delete and in a <code>ListView</code> using the <a href="https://github.com/timroes/SwipeToDismissUndoList">SwipeToDismissUndoList</a> library which extends <a href="https://gist.github.com/romannurik/2980593">Roman Nurik's SwipeToDismiss</a> sample.</p>
  
  <p>My issue is in the delete animation.  Since the <code>ListView</code> is backed by a <code>CursorAdapter</code>, the animation triggers the <code>onDismiss</code> callback in <code>onAnimationEnd</code> but this means that the animation has run and reset itself before the <code>CursorAdapter</code> updates with the delete.</p>
  
  <p>This ends up looking like a flicker to the user where they delete a note by swiping it away, then the view is back for a split second and then disappears because the <code>CursorAdapter</code> has picked up the data change.</p>
  
  <p>Here is my <code>OnDismissCallback</code>:</p>
  
  <pre><code>private SwipeDismissList.OnDismissCallback dismissCallback = 
          new SwipeDismissList.OnDismissCallback() {
      @Override
      public SwipeDismissList.Undoable onDismiss(ListView listView, final int position) {
          Cursor c = mAdapter.getCursor();
          c.moveToPosition(position);
          final int id = c.getInt(Query._ID);
          final Item item = Item.findById(getActivity(), id);
          if (Log.LOGV) Log.v("Deleting item: " + item);
  
          final ContentResolver cr = getActivity().getContentResolver();
          cr.delete(Items.buildItemUri(id), null, null);
          mAdapter.notifyDataSetChanged();
  
          return new SwipeDismissList.Undoable() {
              public void undo() {
                  if (Log.LOGV) Log.v("Restoring Item: " + item);
                  ContentValues cv = new ContentValues();
                  cv.put(Items._ID, item.getId());
                  cv.put(Items.ITEM_CONTENT, item.getContent());
                  cr.insert(Items.CONTENT_URI, cv);
              }
          };
      }
  };
  </code></pre>