Your test/mock screens would look much better with some real data. RandomData automatically fills your structures with generated, random names, numbers, images, etc. RandomData uses data libraries, validating algorithms and keeps track of a context to make sure that every bit of generated data is consistent and makes sense. Did you notice that a female name always comes with a picture of a woman? :)
Before you start, make sure to check out https://www.pexels.com/ - very nice site with free stock photos :)
Add JitPack to your main build.gradle:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add RandomData to your project's dependencies. Select only modules you need (because of their size):
dependencies {
compile 'com.github.ZieIony.RandomData:person:4b76016d78'
}
Prepare a data class:
public class User{
Drawable avatar;
String name, subtext, date;
}
Setup RandomData with generators you need:
RandomData randomData = new RandomData();
randomData.addGenerators(new Generator[]{
new StringNameGenerator(Gender.Both)),
new TextGenerator().withMatcher(f -> f.getName().equals("subtext")),
new DrawableAvatarGenerator(this),
new StringDateGenerator()
});
Fill your objects with data. There's no need to initialize arrays:
User[] items = new User[10];
randomData.fill(items);
- picture
- date
- id
- hash
- lorem ipsum
- avatar
- name
- gender
- phone number
- age
- amount
- card number
It's Carbon. RandomData helps me with carbon.components package.
Open an issue and describe your generator. I'll try to add it.
Sure thing!