Exemplo n.º 1
0
 @Override
 public void onPostExecute(DeckTask.TaskData result) {
   mUndoRedoCardId = result.getLong();
   String undoType = result.getString();
   if (undoType.equals(Deck.UNDO_TYPE_DELETE_CARD)) {
     int position = getPosition(mDeletedCards, mUndoRedoCardId);
     if (position != -1) {
       HashMap<String, String> data = new HashMap<String, String>();
       data.put("id", mDeletedCards.get(position).get("id"));
       data.put("question", mDeletedCards.get(position).get("question"));
       data.put("answer", mDeletedCards.get(position).get("answer"));
       data.put("marSus", mDeletedCards.get(position).get("marSus"));
       mAllCards.add(Integer.parseInt(mDeletedCards.get(position).get("allCardPos")), data);
       mDeletedCards.remove(position);
       updateCardsList();
     } else {
       deleteCard(Long.toString(mUndoRedoCardId), getPosition(mCards, mUndoRedoCardId));
     }
     mProgressDialog.dismiss();
   } else {
     mUndoRedoCard = mDeck.cardFromId(mUndoRedoCardId);
     if (undoType.equals(Deck.UNDO_TYPE_EDIT_CARD)) {
       mUndoRedoCard.fromDB(mUndoRedoCardId);
       int pos = getPosition(mAllCards, mUndoRedoCardId);
       updateCard(mUndoRedoCard, mAllCards, pos);
       pos = getPosition(mCards, mUndoRedoCardId);
       if (pos != -1) {
         updateCard(mUndoRedoCard, mCards, pos);
       }
       updateList();
       mProgressDialog.dismiss();
     } else if (undoType.equals(Deck.UNDO_TYPE_MARK_CARD)) {
       markCards(mUndoRedoCard.getFactId(), mUndoRedoCard.isMarked());
       mProgressDialog.dismiss();
     } else if (undoType.equals(Deck.UNDO_TYPE_SUSPEND_CARD)) {
       suspendCard(
           mUndoRedoCard,
           getPosition(mCards, mUndoRedoCardId),
           mUndoRedoCard.getSuspendedState());
       mProgressDialog.dismiss();
     } else {
       mUndoRedoDialogShowing = true;
       getCards();
     }
   }
 }
Exemplo n.º 2
0
 @Override
 public void onPostExecute(DeckTask.TaskData result) {
   deleteCard(result.getString(), mPositionInCardsList);
   mProgressDialog.dismiss();
 }