Home | History | Annotate | Download | only in cardstream

Lines Matching refs:Card

37  * Cards can be shown or hidden. When a card is shown it can also be marked as not-dismissible, see
44 private LinkedHashMap<String, Card> mVisibleCards = new LinkedHashMap<String, Card>(INITIAL_SIZE);
45 private HashMap<String, Card> mHiddenCards = new HashMap<String, Card>(INITIAL_SIZE);
70 * Add a visible, dismissible card to the card stream.
72 * @param card
74 public void addCard(Card card) {
75 final String tag = card.getTag();
78 final View view = card.getView();
80 mHiddenCards.put(tag, card);
85 * Add and show a card.
87 * @param card
90 public void addCard(Card card, boolean show) {
91 addCard(card);
93 showCard(card.getTag());
98 * Remove a card and return true if it has been successfully removed.
104 // Attempt to remove a visible card first
105 Card card = mVisibleCards.get(tag);
106 if (card != null) {
107 // Card is visible, also remove from layout
109 mLayout.removeView(card.getView());
112 // Card is hidden, no need to remove from layout
113 card = mHiddenCards.remove(tag);
114 return card != null;
119 * Show a dismissible card, returns false if the card could not be shown.
129 * Show a card, returns false if the card could not be shown.
136 final Card card = mHiddenCards.get(tag);
137 // ensure the card is hidden and not already visible
138 if (card != null && !mVisibleCards.containsValue(tag)) {
140 mVisibleCards.put(tag, card);
141 mLayout.addCard(card.getView(), dismissible);
151 * Hides the card, returns false if the card could not be hidden.
157 final Card card = mVisibleCards.get(tag);
158 if (card != null) {
161 mHiddenCards.put(tag, card);
163 mLayout.removeView(card.getView());
171 final Card card = mVisibleCards.get(tag);
172 if (card != null) {
175 mHiddenCards.put(tag, card);
185 * Returns true if the card is shown and is dismissible.
195 * Returns the Card for this tag.
200 public Card getCard(String tag) {
201 final Card card = mVisibleCards.get(tag);
202 if (card != null) {
203 return card;
210 * Moves the view port to show the card with this tag.
216 final Card card = mVisibleCards.get(tag);
217 if (card != null) {
226 public Collection<Card> getVisibleCards() {
232 for (Card c : state.hiddenCards) {
233 Card card = new Card.Builder(callback,c).build(getActivity());
234 mHiddenCards.put(card.getTag(), card);
241 for (Card c : state.visibleCards) {
242 Card card = new Card.Builder(callback,c).build(getActivity());
243 addCard(card);
244 final String tag = card.getTag();
248 // move to first visible card
258 final Card[] visible = cloneCards(mVisibleCards.values());
259 final Card[] hidden = cloneCards(mHiddenCards.values());
266 private Card[] cloneCards(Collection<Card> cards) {
267 Card[] cardArray = new Card[cards.size()];
269 for (Card c : cards) {