Beispiel #1
0
  public void addCard(Card card, boolean refresh) {

    CardStack stack = new CardStack(mSlideIn);
    stack.add(card);
    mStacks.add(stack);
    if (refresh) refresh();
  }
Beispiel #2
0
  public void addSeparateCards(Card[] cards, boolean refresh) {

    for (int i = 0; i < cards.length; i++) {
      CardStack stack = new CardStack();
      stack.add(cards[i]);
      mStacks.add(stack);
    }

    if (refresh) refresh();
  }
Beispiel #3
0
 public void addCardToLastStack(Card card, boolean refresh) {
   if (mStacks.isEmpty()) {
     addCard(card, refresh);
     return;
   }
   int lastItemPos = mStacks.size() - 1;
   CardStack cardStack = (CardStack) mStacks.get(lastItemPos);
   cardStack.add(card);
   mStacks.set(lastItemPos, cardStack);
   if (refresh) refresh();
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final CardStack stack = getItem(position);
    stack.setAdapter(this);
    stack.setPosition(position);

    // TODO: caching is not working well

    // if (convertView != null) {
    // CardStack tagStack = (CardStack) convertView.getTag();
    // ArrayList<Card> tagCards = tagStack.getCards();
    // ArrayList<Card> cards = stack.getCards();
    // Card lastTagCard = tagCards.get(tagCards.size()-1);
    // if (!lastTagCard.equals(cards.get(cards.size()-1))) {
    // convertView = stack.getView(mContext);
    // convertView.setTag(stack);
    // }
    // } else if (convertView == null) {
    convertView = stack.getView(mContext, mSwipeable);
    // convertView.setTag(stack);
    // }

    return convertView;
  }
 public void setCurrentStackTitle(String title) {
   CardStack cardStack = (CardStack) mStacks.get(getLastCardStackPosition());
   cardStack.setTitle(title);
 }
Beispiel #6
0
 public void addSwipableCard(Card card, boolean refresh, boolean swipable) {
   CardStack stack = new CardStack(mSlideIn, swipable);
   stack.add(card);
   mStacks.add(stack);
   if (refresh) refresh();
 }