CardsUI
===================
An open source library offering the popular Google Now & Google Play cards views, additionnal features, view recycling and an optional Model-View-Controller structure.
## Google Play Cards
This new type of card based on the new Google play design are highly customizable.
The parameters include :
* Title text (String)
* Description text (String)
* Title color (String)
* Stripe color (String)
* Menu overflow (Boolean)
* Touch feedback on click (Boolean)
Here is an example :
mCardView.addCard(new MyPlayCard(
"Different Colors for Title & Stripe",
"You can set any color for the title and any other color for the left stripe",
"#f2a400", "#9d36d0", true, false));
## Additionnal Features
In addition to the Google Play cards, I made a few changes to the original library by [Nadav Fima](https://github.com/nadavfima/cardsui-for-android).
Those changes include :
* **Setting regular cards's description text programmatically**
Called like this :
mCardView.addCard(new MyCard("title string", "description string");
* **Setting stack titles's color programmatically_**
Called like this :
CardStack stack = new CardStack();
stack.setTitle("Card Title");
stack.setColor("#33b5e5");
mCardView.addStack(stack);
* **Attaching arbitrary data to cards**
The `data` property of `AbstractCard` allows the programmer to attach arbitrary data to any `Card` or even a stack of cards, since `CardStack extends AbstractCard`.
This attached data can be set and retrived in the following fashion:
```java
Integer myData = 42;
card.setData(myData);
//...
Integer theData = (Integer) card.getData();
// theData == 42
```
* **Setting custom card backgrounds**
If you want to provide a custom `Drawable` for the `Card`'s background, then use the `setBackgroundResource()` method:
```java
card.setBackgroundResource(R.drawable.custom_card_bg);
```
## Model-View-Controller implementation
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`.
You can check-out an example at FLamparski's [FLamparski/areabase](Areabase), namely in 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);
```
Special thanks to [https://github.com/FLamparski](FLamparski) for the MVC implementation and data attachement/background modification commits.
## CardsUI Generator
I'm working on a supplementary example app for the CardsUI library. This app includes a little daemon to generate cards and set their parameters with a nice animated gui.
Ultimately, the aim of this app will be to generate a zip file containing the code & resources needed for the cards "activity" the user generated in the app.
Considering that the cards layouts need to be on the app side, and not on the library side, this could be useful.
![screenshot1](http://imageshack.us/a/img837/1365/cardsgen1.png) ![screenshot2](http://imageshack.us/a/img708/8929/cardsgen2.png) ![screenshot3](http://imageshack.us/a/img90/7456/cardsgen3.png) ![screenshot4](http://imageshack.us/a/img109/9287/cardsgen4.png) ![screenshot5](http://imageshack.us/a/img209/8982/cardsgen5.png) ![screenshot6](http://imageshack.us/a/img515/4987/cardsgen6.png)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
仿passbook卡片设计 (111个子文件)
CardsUIExample.apk 827KB
gradlew.bat 2KB
.classpath 466B
.classpath 466B
.classpath 466B
.gitattributes 483B
.gitignore 165B
.gitmodules 278B
build.gradle 1KB
gradlew 5KB
nineoldandroids-2.4.0.jar 108KB
gradle-wrapper.jar 49KB
CardStack.java 15KB
MainActivity.java 14KB
CardUI.java 12KB
SwipeDismissTouchListener.java 8KB
CardModel.java 6KB
Card.java 6KB
CardFactory.java 4KB
MainActivity.java 3KB
RecyclableCard.java 2KB
StackAdapter.java 2KB
MyPlayCard.java 1KB
QuickReturnListView.java 1KB
MyPlayCard.java 1KB
AbstractCard.java 1KB
Utils.java 1KB
MyImageCard.java 693B
MyCard.java 636B
MyImageCard.java 589B
MyCard.java 439B
url3.jpeg 109KB
url3.jpeg 109KB
url2.jpeg 34KB
url2.jpeg 34KB
url1.jpeg 8KB
url1.jpeg 8KB
README.md 4KB
ic_launcher-web.png 12KB
ic_launcher-web.png 12KB
ic_action_search.png 3KB
ic_action_search.png 3KB
top_shadow.png 3KB
ic_action_refresh.png 2KB
ic_launcher.png 2KB
ic_launcher.png 2KB
ic_action_refresh.png 1KB
ic_action_expand.png 1KB
ic_action_collapse.png 1024B
card_background_shadow.9.png 863B
ic_action_refresh.png 806B
ic_action_expand.png 801B
ic_action_collapse.png 770B
ic_action_settings.png 713B
ic_action_settings.png 557B
card_shadow.9.png 528B
ic_action_expand.png 502B
ic_action_collapse.png 484B
ic_action_settings.png 365B
card_background.9.png 267B
ic_menu_moreoverflow_normal_holo_light.png 184B
.project 819B
.project 817B
.project 813B
project.properties 706B
project.properties 605B
project.properties 584B
gradle-wrapper.properties 230B
LICENSE.txt 11KB
proguard-project.txt 781B
proguard-project.txt 781B
proguard-project.txt 781B
activity_main.xml 12KB
dimens.xml 10KB
styles.xml 3KB
card_play.xml 3KB
card_play.xml 3KB
card_picture.xml 2KB
card_picture.xml 2KB
card_ex.xml 2KB
card_ex.xml 2KB
strings.xml 1KB
grey_background_cardbank.xml 1KB
selectable_background_cardbank.xml 1KB
selectable_background_cardbank.xml 1KB
footer_fragment.xml 1KB
item_stack.xml 907B
cards_view.xml 862B
AndroidManifest.xml 803B
AndroidManifest.xml 771B
card.xml 761B
cards_view_multicolumn.xml 694B
header.xml 489B
colors.xml 453B
strings.xml 423B
activity_main.xml 391B
item_card_empty_first.xml 329B
item_play_card_empty_first.xml 329B
item_card_empty_last.xml 301B
item_card.xml 301B
共 111 条
- 1
- 2
资源评论
听风丨说话
- 粉丝: 55
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功