use of com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction in project material-about-library by daniel-stoneuk.
the class ExampleMaterialAboutActivity method getMaterialAboutList.
@NonNull
@Override
protected MaterialAboutList getMaterialAboutList(@NonNull final Context c) {
MaterialAboutCard.Builder advancedCardBuilder = new MaterialAboutCard.Builder();
advancedCardBuilder.title("Advanced");
advancedCardBuilder.addItem(new MaterialAboutTitleItem.Builder().text("TitleItem OnClickAction").icon(R.mipmap.ic_launcher).setOnClickAction(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse("http://www.danstone.uk"))).build());
advancedCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Snackbar demo").icon(new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_code_tags).sizeDp(18)).setOnClickAction(new MaterialAboutItemOnClickAction() {
@Override
public void onClick() {
Snackbar.make(getRecyclerView(), "Test", Snackbar.LENGTH_SHORT).show();
}
}).build());
advancedCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("OnLongClickAction demo").icon(new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_hand_pointing_right).sizeDp(18)).setOnLongClickAction(new MaterialAboutItemOnClickAction() {
@Override
public void onClick() {
Toast.makeText(c, "Long pressed", Toast.LENGTH_SHORT).show();
}
}).build());
advancedCardBuilder.addItem(new MyCustomItem.Builder().text("Custom Item").icon(new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_code_braces).sizeDp(18)).build());
advancedCardBuilder.addItem(createDynamicItem("Tap for a random number & swap position", c));
MaterialAboutCard.Builder customAdapterCardBuilder = new MaterialAboutCard.Builder();
// Create list of libraries
List<Library> libraries = new ArrayList<>();
// Add libraries that are hosted on GitHub with an Apache v2 license.
libraries.add(Licenses.fromGitHubApacheV2("yshrsmz/LicenseAdapter"));
libraries.add(Licenses.fromGitHubApacheV2("daniel-stoneuk/material-about-library"));
customAdapterCardBuilder.title("Custom Adapter (License Adapter)");
customAdapterCardBuilder.customAdapter(new LicenseAdapter(libraries));
return Demo.createMaterialAboutList(c, getIntent().getIntExtra(THEME_EXTRA, THEME_LIGHT)).addCard(advancedCardBuilder.build()).addCard(customAdapterCardBuilder.build());
}
Aggregations