https://github.com/thiagokimo/faker
Provides fake data to your Android apps :)
https://github.com/thiagokimo/faker
android data faker mock mocking
Last synced: about 1 month ago
JSON representation
Provides fake data to your Android apps :)
- Host: GitHub
- URL: https://github.com/thiagokimo/faker
- Owner: thiagokimo
- License: apache-2.0
- Created: 2015-06-07T14:24:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-06T08:42:55.000Z (over 7 years ago)
- Last Synced: 2023-11-07T15:24:24.779Z (almost 2 years ago)
- Topics: android, data, faker, mock, mocking
- Language: Java
- Homepage:
- Size: 1.45 MB
- Stars: 243
- Watchers: 13
- Forks: 31
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Faker
[](https://android-arsenal.com/details/1/2039)
[](https://travis-ci.org/thiagokimo/Faker)Faker provides fake data to your Android MPVs. Now it's very handy to make screenshots of your apps without worrying with Google Play copyright infringments, e.g [this app](https://play.google.com/store/apps/details?id=io.kimo.tmdb). Faker helps you to populate your views with random data quickly and painlessly.
## Screenshots

## Demo
The sample application (the source is in the **app** folder) has been published on Google Play to facilitate the access:[](https://play.google.com/store/apps/details?id=io.kimo.faker)
The demo app has a very clean MVP architecture based in the idea of [this post](http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/). Feel free to give me suggestions.
## Setup
Gradle:
Add the JitPack repository to your build file:
``` groovy
repositories {
maven {
url "https://jitpack.io"
}
}
```Add the dependency in the form:
``` groovy
dependencies {
compile 'com.github.thiagokimo:faker:VERSION'
}
```Maven:
If you use Maven, add this into your build file:
``` xml
jitpack.io
https://jitpack.io```
``` xml
com.github.thiagokimo
faker
VERSION```
## Usage
### The "lazy" way
``` java
Faker.with(context)
.fill(rootView);
```Faker will figure out all views inside the one you passed to it and fill it with proper data. Just like that!
By default faker will fill **TextViews** with lorem ipsum, **ImageViews** with a random color, **CompoundButtons** with a random state (check or uncheck) and **ProgressBars** with a random progress value.
### The specific way
``` java
Faker.with(context)
.NameOfTheComponent
.componentMethod();
```### Targeting views
If you want Faker to fill specific views inside your ViewGroup you can pass your target views like the example below
``` java
Faker.with(context)
.targetViews(collection-of-ids)
.fill(rootView);
```Check out all examples [here](https://github.com/thiagokimo/Faker/tree/master/app/src/main/java/io/kimo/faker/mvp/presenter).
## Components
Faker is organized in components that provides you specific types of data. Here is a list of the current components:
* [Lorem](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/text/LoremComponent.java) - The old good lorem ispum words, sentences and paragraphs.
* [Name](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/text/NameComponent.java) - Firsts, lasts, full and complete names and profession/titles.
* [Number](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/number/NumberComponent.java) - It gives you numbers ¬¬
* [Phone](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/text/PhoneComponent.java) - Phone masks \o/
* [Internet](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/text/InternetComponent.java) - It provides you random emails and domains.
* [Url](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/text/URLComponent.java) - Gives you (valid) urls that you might use somewhere.
* [Color](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/number/ColorComponent.java) - Generates attractive colors thanks to [lzyzsd](https://github.com/lzyzsd/AndroidRandomColor)!
* [Address](https://github.com/thiagokimo/Faker/blob/master/faker-core/src/main/java/io/kimo/lib/faker/component/text/AddressComponent.java) - Gives random cities, countries, zipcodes, states and so on.## Contribuiting
1. Fork it
2. Create your feature/bug-fix branch(`git checkout -b my-new-feature-or-fix`)
3. Commit your changes (`git commit -am 'Add some feature/fix'`)
4. Do your pull-requestMake sure you write tests for your code. Only code with passing tests will be accepted.
### Components
You can add more components or improve the existing ones. For new components, make sure you also add an example in the demo app.
### Localization
You can help providing localized data to Faker components.## License
Copyright 2011, 2012 Thiago RochaLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.