Androguide/cardsui-for-android — pull request #2 by FLamparski (2013-08-24 14:52:27+00:00)
Title: Added a Model structure that allows you to serialize it (and thus add it to a Bundle) which can be turned into any descendant of AbstractCard.

# MVC for CardsUI
The `CardModel` is essentially a copy of `AbstractCard`, except that it is concrete, Serializable, and specifies a target type that should be used when put through `CardFactory.createCard(CardModel)`.

`CardFactory` defines a single, static function, `createCard(CardModel)`, which uses the Reflection API to inflate a `CardModel` into a descendant of `AbstractCard` as specified by `model.cardClass`. This is tested and works, to see it in action, check out [FLamparski/areabase](Areabase), namely the [SummaryFragment class](https://github.com/FLamparski/areabase/blob/master/Areabase/src/lamparski/areabase/SummaryFragment.java).

**Example:**

```java
CardModel model = new CardModel("This is the card's description", "This is the card's title", BasicCard.class);
BasicCard card = (BasicCard) CardFactory.createCard(model); // This cast is safe
mCardUI.addCard(card);
```

# Smaller changes
## Arbitrary data for cards
This commit added a `data` property to `AbstractCard`, which is simply an `Object`. This allows the programmer to attach arbitrary data to any `Card` or even a stack of cards, since `CardStack extends AbstractCard`.
```java
Integer myData = 42;
card.setData(myData);
//...
Integer theData = (Integer) card.getData();
// theData == 42
```
## Custom card backgrounds
If you want to provide a custom `Drawable`, then just do the following:
```java
card.setBackgroundResource(R.drawable.custom_card_bg);
```