Search in sources :

Example 1 with MaterialAboutCard

use of com.danielstone.materialaboutlibrary.model.MaterialAboutCard in project material-about-library by daniel-stoneuk.

the class Demo method createMaterialAboutLicenseList.

public static MaterialAboutList createMaterialAboutLicenseList(final Context c, int colorIcon) {
    MaterialAboutCard materialAboutLIbraryLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).color(ContextCompat.getColor(c, colorIcon)).sizeDp(18), "material-about-library", "2016", "Daniel Stone", OpenSourceLicense.APACHE_2);
    MaterialAboutCard androidIconicsLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).color(ContextCompat.getColor(c, colorIcon)).sizeDp(18), "Android Iconics", "2016", "Mike Penz", OpenSourceLicense.APACHE_2);
    MaterialAboutCard leakCanaryLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).color(ContextCompat.getColor(c, colorIcon)).sizeDp(18), "LeakCanary", "2015", "Square, Inc", OpenSourceLicense.APACHE_2);
    MaterialAboutCard mitLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).color(ContextCompat.getColor(c, colorIcon)).sizeDp(18), "MIT Example", "2017", "Matthew Ian Thomson", OpenSourceLicense.MIT);
    MaterialAboutCard gplLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).color(ContextCompat.getColor(c, colorIcon)).sizeDp(18), "GPL Example", "2017", "George Perry Lindsay", OpenSourceLicense.GNU_GPL_3);
    return new MaterialAboutList(materialAboutLIbraryLicenseCard, androidIconicsLicenseCard, leakCanaryLicenseCard, mitLicenseCard, gplLicenseCard);
}
Also used : MaterialAboutList(com.danielstone.materialaboutlibrary.model.MaterialAboutList) MaterialAboutCard(com.danielstone.materialaboutlibrary.model.MaterialAboutCard) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 2 with MaterialAboutCard

use of com.danielstone.materialaboutlibrary.model.MaterialAboutCard in project material-about-library by daniel-stoneuk.

the class Demo method createMaterialAboutLicenseList.

public static MaterialAboutList createMaterialAboutLicenseList(final Context c) {
    MaterialAboutCard materialAboutLibraryLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "material-about-library", "2016", "Daniel Stone", OpenSourceLicense.APACHE_2);
    MaterialAboutCard androidIconicsLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "Android Iconics", "2016", "Mike Penz", OpenSourceLicense.APACHE_2);
    MaterialAboutCard leakCanaryLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "LeakCanary", "2015", "Square, Inc", OpenSourceLicense.APACHE_2);
    MaterialAboutCard mitLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "MIT Example", "2017", "Matthew Ian Thomson", OpenSourceLicense.MIT);
    MaterialAboutCard gplLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "GPL Example", "2017", "George Perry Lindsay", OpenSourceLicense.GNU_GPL_3);
    return new MaterialAboutList(materialAboutLibraryLicenseCard, androidIconicsLicenseCard, leakCanaryLicenseCard, mitLicenseCard, gplLicenseCard);
}
Also used : MaterialAboutList(com.danielstone.materialaboutlibrary.model.MaterialAboutList) MaterialAboutCard(com.danielstone.materialaboutlibrary.model.MaterialAboutCard) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 3 with MaterialAboutCard

use of com.danielstone.materialaboutlibrary.model.MaterialAboutCard in project Giua-App by Giua-app.

the class AboutActivity method createMaterialAboutLicenseList.

public static MaterialAboutList createMaterialAboutLicenseList(final Context c) {
    MaterialAboutCard appIntroLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "AppIntro", "2015-2020", "AppIntro Developers", OpenSourceLicense.APACHE_2);
    MaterialAboutCard giuaScraperLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "Giua Webscraper", "2021-2022", "Hiem, Franck1421 and contributors", OpenSourceLicense.GNU_GPL_3);
    MaterialAboutCard caocLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "CustomActivityOnCrash", "", "Eduard Ereza Martínez", OpenSourceLicense.MIT);
    MaterialAboutCard jsoupLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "JSoup", "2009-2021", "Jonathan Hedley", OpenSourceLicense.MIT);
    MaterialAboutCard materialAboutLibraryLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "material-about-library", "2016", "Daniel Stone", OpenSourceLicense.APACHE_2);
    MaterialAboutCard androidIconicsLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "Android Iconics", "2016", "Mike Penz", OpenSourceLicense.APACHE_2);
    MaterialAboutCard leakCanaryLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "LeakCanary", "2015", "Square, Inc", OpenSourceLicense.APACHE_2);
    MaterialAboutCard androidChartLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "MPAndroidChart", "2020", "Philipp Jahoda", OpenSourceLicense.APACHE_2);
    MaterialAboutCard drawerLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "Material Drawer", "2021", "Mike Penz", OpenSourceLicense.APACHE_2);
    MaterialAboutCard calendarLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "Compact Calendar View", "2017", "Sundeepk", OpenSourceLicense.MIT);
    MaterialAboutCard glideLicenseCard = ConvenienceBuilder.createLicenseCard(c, new IconicsDrawable(c).icon(CommunityMaterial.Icon.cmd_book).sizeDp(18), "Glide", "2014", "bumptech", // FIXME: NON E' LA VERA LICENZA
    OpenSourceLicense.APACHE_2);
    return new MaterialAboutList(giuaScraperLicenseCard, appIntroLicenseCard, caocLicenseCard, jsoupLicenseCard, materialAboutLibraryLicenseCard, androidIconicsLicenseCard, leakCanaryLicenseCard, androidChartLicenseCard, drawerLicenseCard, calendarLicenseCard, glideLicenseCard);
}
Also used : MaterialAboutList(com.danielstone.materialaboutlibrary.model.MaterialAboutList) MaterialAboutCard(com.danielstone.materialaboutlibrary.model.MaterialAboutCard) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 4 with MaterialAboutCard

use of com.danielstone.materialaboutlibrary.model.MaterialAboutCard in project material-about-library by daniel-stoneuk.

the class MaterialAboutListAdapter method setData.

public void setData(ArrayList<MaterialAboutCard> newData) {
    List<MaterialAboutCard> data = new ArrayList<>();
    for (MaterialAboutCard card : newData) {
        data.add(card.clone());
    }
    differ.submitList(data);
}
Also used : MaterialAboutCard(com.danielstone.materialaboutlibrary.model.MaterialAboutCard) ArrayList(java.util.ArrayList)

Example 5 with MaterialAboutCard

use of com.danielstone.materialaboutlibrary.model.MaterialAboutCard in project material-about-library by daniel-stoneuk.

the class MaterialAboutListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(MaterialAboutListViewHolder holder, int position) {
    MaterialAboutCard card = differ.getCurrentList().get(position);
    if (holder.cardView instanceof CardView) {
        CardView cardView = (CardView) holder.cardView;
        int cardColor = card.getCardColor();
        if (cardColor != 0) {
            cardView.setCardBackgroundColor(cardColor);
        } else {
            cardView.setCardBackgroundColor(cardView.getCardBackgroundColor().getDefaultColor());
        }
    }
    CharSequence title = card.getTitle();
    int titleRes = card.getTitleRes();
    holder.title.setVisibility(View.VISIBLE);
    if (title != null) {
        holder.title.setText(title);
    } else if (titleRes != 0) {
        holder.title.setText(titleRes);
    } else {
        holder.title.setVisibility(View.GONE);
    }
    int titleColor = card.getTitleColor();
    if (holder.title.getVisibility() == View.VISIBLE) {
        if (titleColor != 0) {
            holder.title.setTextColor(titleColor);
        } else {
            holder.title.setTextColor(holder.title.getTextColors().getDefaultColor());
        }
    }
    if (holder.cardView instanceof MaterialCardView) {
        MaterialCardView materialCardView = (MaterialCardView) holder.cardView;
        if (card.isOutline()) {
            materialCardView.setStrokeWidth((int) context.getResources().getDimension(R.dimen.mal_stroke_width));
            materialCardView.setCardElevation(0);
        } else {
            materialCardView.setStrokeWidth(0);
            materialCardView.setCardElevation(context.getResources().getDimension(R.dimen.mal_card_elevation));
        }
    }
    if (card.getCustomAdapter() != null) {
        holder.useCustomAdapter(card.getCustomAdapter());
    } else {
        holder.useMaterialAboutItemAdapter();
        ((MaterialAboutItemAdapter) holder.adapter).setData(card.getItems());
    }
}
Also used : MaterialCardView(com.google.android.material.card.MaterialCardView) MaterialAboutCard(com.danielstone.materialaboutlibrary.model.MaterialAboutCard) MaterialCardView(com.google.android.material.card.MaterialCardView) CardView(androidx.cardview.widget.CardView)

Aggregations

MaterialAboutCard (com.danielstone.materialaboutlibrary.model.MaterialAboutCard)5 MaterialAboutList (com.danielstone.materialaboutlibrary.model.MaterialAboutList)3 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)3 CardView (androidx.cardview.widget.CardView)1 MaterialCardView (com.google.android.material.card.MaterialCardView)1 ArrayList (java.util.ArrayList)1