Home | History | Annotate | Download | only in cardstream

Lines Matching refs:Card

34  * Cards can be shown or hidden. When a card is shown it can also be marked as not-dismissible, see
41 private LinkedHashMap<String, Card> mVisibleCards = new LinkedHashMap<String, Card>(INITIAL_SIZE);
42 private HashMap<String, Card> mHiddenCards = new HashMap<String, Card>(INITIAL_SIZE);
67 * Add a visible, dismissible card to the card stream.
69 * @param card
71 public void addCard(Card card) {
72 final String tag = card.getTag();
75 final View view = card.getView();
77 mHiddenCards.put(tag, card);
82 * Add and show a card.
84 * @param card
87 public void addCard(Card card, boolean show) {
88 addCard(card);
90 showCard(card.getTag());
95 * Remove a card and return true if it has been successfully removed.
101 // Attempt to remove a visible card first
102 Card card = mVisibleCards.get(tag);
103 if (card != null) {
104 // Card is visible, also remove from layout
106 mLayout.removeView(card.getView());
109 // Card is hidden, no need to remove from layout
110 card = mHiddenCards.remove(tag);
111 return card != null;
116 * Show a dismissible card, returns false if the card could not be shown.
126 * Show a card, returns false if the card could not be shown.
133 final Card card = mHiddenCards.get(tag);
134 // ensure the card is hidden and not already visible
135 if (card != null && !mVisibleCards.containsValue(tag)) {
137 mVisibleCards.put(tag, card);
138 mLayout.addCard(card.getView(), dismissible);
148 * Hides the card, returns false if the card could not be hidden.
154 final Card card = mVisibleCards.get(tag);
155 if (card != null) {
158 mHiddenCards.put(tag, card);
160 mLayout.removeView(card.getView());
168 final Card card = mVisibleCards.get(tag);
169 if (card != null) {
172 mHiddenCards.put(tag, card);
182 * Returns true if the card is shown and is dismissible.
192 * Returns the Card for this tag.
197 public Card getCard(String tag) {
198 final Card card = mVisibleCards.get(tag);
199 if (card != null) {
200 return card;
207 * Moves the view port to show the card with this tag.
213 final Card card = mVisibleCards.get(tag);
214 if (card != null) {
223 public Collection<Card> getVisibleCards() {
229 for (Card c : state.hiddenCards) {
230 Card card = new Card.Builder(callback,c).build(getActivity());
231 mHiddenCards.put(card.getTag(), card);
238 for (Card c : state.visibleCards) {
239 Card card = new Card.Builder(callback,c).build(getActivity());
240 addCard(card);
241 final String tag = card.getTag();
245 // move to first visible card
255 final Card[] visible = cloneCards(mVisibleCards.values());
256 final Card[] hidden = cloneCards(mHiddenCards.values());
263 private Card[] cloneCards(Collection<Card> cards) {
264 Card[] cardArray = new Card[cards.size()];
266 for (Card c : cards) {