Search in sources :

Example 1 with LicenseAdapter

use of net.yslibrary.licenseadapter.LicenseAdapter 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());
}
Also used : MaterialAboutTitleItem(com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem) MaterialAboutItemOnClickAction(com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction) MaterialAboutCard(com.danielstone.materialaboutlibrary.model.MaterialAboutCard) LicenseAdapter(net.yslibrary.licenseadapter.LicenseAdapter) ConvenienceBuilder(com.danielstone.materialaboutlibrary.ConvenienceBuilder) MaterialAboutActionItem(com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem) ArrayList(java.util.ArrayList) Library(net.yslibrary.licenseadapter.Library) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)1 ConvenienceBuilder (com.danielstone.materialaboutlibrary.ConvenienceBuilder)1 MaterialAboutActionItem (com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem)1 MaterialAboutItemOnClickAction (com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickAction)1 MaterialAboutTitleItem (com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem)1 MaterialAboutCard (com.danielstone.materialaboutlibrary.model.MaterialAboutCard)1 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)1 ArrayList (java.util.ArrayList)1 Library (net.yslibrary.licenseadapter.Library)1 LicenseAdapter (net.yslibrary.licenseadapter.LicenseAdapter)1