use of com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem in project material-about-library by daniel-stoneuk.
the class ExampleMaterialAboutFragment method getMaterialAboutList.
@Override
protected MaterialAboutList getMaterialAboutList(final Context c) {
MaterialAboutList list = Demo.createMaterialAboutList(c, THEME_LIGHT);
list.getCards().get(2).getItems().add(createDynamicItem("Tap for a random number", c));
final MaterialAboutActionItem time = new MaterialAboutActionItem.Builder().text("Unix Time In Millis").subText("Time").icon(new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_clock).sizeDp(18)).build();
list.getCards().get(2).getItems().add(time);
return list;
}
use of com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem in project material-about-library by daniel-stoneuk.
the class ExampleMaterialAboutActivity method createDynamicItem.
private MaterialAboutActionItem createDynamicItem(String subText, final Context c) {
final MaterialAboutActionItem item = new MaterialAboutActionItem.Builder().text("Dynamic UI").subText(subText).icon(new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_refresh).sizeDp(18)).build();
item.setOnClickAction(new MaterialAboutItemOnClickAction() {
@Override
public void onClick() {
getList().getCards().get(4).getItems().remove(getList().getCards().get(4).getItems().indexOf(item));
int newIndex = ((int) (Math.random() * 5));
getList().getCards().get(4).getItems().add(newIndex, item);
item.setSubText("Random number: " + ((int) (Math.random() * 10)));
setMaterialAboutList(getList());
}
});
return item;
}
use of com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem in project material-about-library by daniel-stoneuk.
the class ExampleMaterialAboutFragment method createDynamicItem.
private MaterialAboutActionItem createDynamicItem(String subText, final Context c) {
final MaterialAboutActionItem item = new MaterialAboutActionItem.Builder().text("Dynamic UI").subText(subText).icon(new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_refresh).sizeDp(18)).build();
item.setOnClickAction(new MaterialAboutItemOnClickAction() {
@Override
public void onClick() {
item.setSubText("Random number: " + ((int) (Math.random() * 10)));
refreshMaterialAboutList();
}
});
return item;
}
Aggregations