daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

Feature: MaterialAboutList Methode add #32

Closed Scrounger closed 7 years ago

Scrounger commented 7 years ago

@daniel-stoneuk: Because now, i would like to use your lib for diffrent thins like About, Changelog and licences, i nedd a method to dynamically add cards to MaterialAboutList.

Could you please implement a .add Method to MaterialAboutList or a Constructor that accepts a List?

daniel-stoneuk commented 7 years ago

The MaterialAboutList contains a constructor that accepts a varargs list. I will add this functionality in the future, however for now you can pass in cardArray.toArray(new MaterialAboutCard[cardArray.size()]).

daniel-stoneuk commented 7 years ago

MaterialAboutList.Builder() also has an .addCard() method which is what you're looking for(?)

Unless you want to change the contents of the list once the activity or fragment has been initialised, that is.

Scrounger commented 7 years ago

i have a json file with changelog for each version. For each version i would like to create a MaterialAboutCard. So i have to iterate throug the *.json file and create dynamically the MaterialAboutCards before initialising

So using a MaterialAboutCard[] cardArray is the solution, thanks!

MaterialAboutList.Builder() also has an .addCard() method which is what you're looking for?

really didn't get this to work. Can you please post a little example?

daniel-stoneuk commented 7 years ago

Check out the README:

Return the list:

Create a MaterialAboutList using MaterialAboutList.Builder(), passing in the cards you would like to display.

        return new MaterialAboutList.Builder()
                .addCard(supportCardBuilder.build())
                .build();
    }
}