@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();
     }
   }
 }
 private void updateCard(Card card, ArrayList<HashMap<String, String>> list, int position) {
   list.get(position).put("question", Utils.stripHTML(card.getQuestion().replace("<br>", "\n")));
   list.get(position).put("answer", Utils.stripHTML(card.getAnswer().replace("<br>", "\n")));
   for (long cardId : mDeck.getCardsFromFactId(card.getFactId())) {
     if (cardId != card.getId()) {
       int positionC = getPosition(mCards, cardId);
       int positionA = getPosition(mAllCards, cardId);
       Card c = mDeck.cardFromId(cardId);
       String question = Utils.stripHTML(c.getQuestion().replace("<br>", "\n"));
       String answer = Utils.stripHTML(c.getAnswer().replace("<br>", "\n"));
       if (positionC != -1) {
         mCards.get(positionC).put("question", question);
         mCards.get(positionC).put("answer", answer);
       }
       mAllCards.get(positionA).put("question", question);
       mAllCards.get(positionA).put("answer", answer);
     }
   }
 }
 @Override
 public void onProgressUpdate(DeckTask.TaskData... values) {
   mSelectedCard = values[0].getCard();
   markCards(mSelectedCard.getFactId(), !mIsMarked);
 }