Code Monkey home page Code Monkey logo

randomdata's Introduction

RandomData

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 :)

Screenshot Screenshot2

Setup

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'
}

Usage

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);

Modules

Common
  • picture
  • date
  • id
  • hash
  • lorem ipsum
Person
  • avatar
  • name
  • email
  • gender
  • phone number
  • age
Finance
  • amount
  • card number

FAQ

1. Where did you get these nice recycler rows from?

It's Carbon. RandomData helps me with carbon.components package.

2. I need a generator you don't have

Open an issue and describe your generator. I'll try to add it.

3. I've coded a generator. Can I make a pull request?

Sure thing!

randomdata's People

Contributors

zieiony avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.