Androguide/cardsui-for-android — pull request #6 by ktrnka (2013-10-02 04:46:09+00:00)
Title: Merge Card recycling

When using CardStacks with only one Card, this will recycle the cards. It's compatible with CardStacks that have many Cards but only attempts to recycle stacks with only one card. Highlights:
-It checks the layout ID of the card content so it's safe in situations where there are multiple kinds of cards in the same CardsUI. I tested this in my app.
-I implemented a RecyclableCard and tested it with my own app and the example project. Works well and reduces code size compared to coding the recycling mechanism for each card.

I've never done a pull request before, sorry! I meant to exclude project properties.

Changes:
CardsExample/src/com/cardsui/example/*.java: changed cards to extend RecyclableCard

CardsUILib/res/layout/cards_view.xml: can ignore, I think this was related to padding changes
CardsUILib/res/layout/item_play_card_empty_first.xml: can ignore, padding change not necessary
CardsUILib/res/layout/item_stack.xml: the added android:id is necessary, padding change not necessary

CardsUILib/src/com/fima/cardsui/StackAdapter.java: enabled code to attempt recycling
CardsUILib/src/com/fima/cardsui/objects/Card.java: added functions to support recycling
CardsUILib/src/com/fima/cardsui/objects/CardStack.java: attempts to recycle before inflating a new CardStack. Also checked for first card before last to have better look for single cards. Added function to attempt recycling.
CardsUILib/src/com/fima/cardsui/objects/RecyclableCard.java: convenience class for easier implementation. People using the API should switch from Card to RecyclableCard if they want recycling.