Search in sources :

Example 1 with MaterialAboutActionItem

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;
}
Also used : MaterialAboutList(com.danielstone.materialaboutlibrary.model.MaterialAboutList) MaterialAboutActionItem(com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 2 with MaterialAboutActionItem

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;
}
Also used : MaterialAboutItemOnClickAction(com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction) MaterialAboutActionItem(com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem) ConvenienceBuilder(com.danielstone.materialaboutlibrary.ConvenienceBuilder) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 3 with MaterialAboutActionItem

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;
}
Also used : MaterialAboutItemOnClickAction(com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction) MaterialAboutActionItem(com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Aggregations

MaterialAboutActionItem (com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem)3 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)3 MaterialAboutItemOnClickAction (com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction)2 ConvenienceBuilder (com.danielstone.materialaboutlibrary.ConvenienceBuilder)1 MaterialAboutList (com.danielstone.materialaboutlibrary.model.MaterialAboutList)1