コード例 #1
0
 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);
     }
   }
 }
コード例 #2
0
 private void markCards(long factId, boolean mark) {
   for (long cardId : mDeck.getCardsFromFactId(factId)) {
     int positionC = getPosition(mCards, cardId);
     int positionA = getPosition(mAllCards, cardId);
     String marSus = mAllCards.get(positionA).get("marSus");
     if (mark) {
       marSus = "1" + marSus.substring(1, 2);
       if (positionC != -1) {
         mCards.get(positionC).put("marSus", marSus);
       }
       mAllCards.get(positionA).put("marSus", marSus);
     } else {
       marSus = "0" + marSus.substring(1, 2);
       if (positionC != -1) {
         mCards.get(positionC).put("marSus", marSus);
       }
       mAllCards.get(positionA).put("marSus", marSus);
     }
   }
   updateList();
 }