Repository: thiagokimo/Faker
Branch: master
Commit: 8b0eccd49981
Files: 108
Total size: 323.8 KB
Directory structure:
gitextract_z0fqpsma/
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── io/
│ │ └── kimo/
│ │ └── faker/
│ │ ├── FakerApp.java
│ │ ├── mvp/
│ │ │ ├── BasePresenter.java
│ │ │ ├── BaseView.java
│ │ │ ├── Presenter.java
│ │ │ ├── View.java
│ │ │ ├── presenter/
│ │ │ │ ├── AddressPresenter.java
│ │ │ │ ├── ColorPresenter.java
│ │ │ │ ├── InternetPresenter.java
│ │ │ │ ├── LoremPresenter.java
│ │ │ │ ├── NamePresenter.java
│ │ │ │ ├── NumberPresenter.java
│ │ │ │ ├── PhonePresenter.java
│ │ │ │ └── UrlPresenter.java
│ │ │ └── view/
│ │ │ ├── AddressView.java
│ │ │ ├── ColorView.java
│ │ │ ├── InternetView.java
│ │ │ ├── LoremView.java
│ │ │ ├── NameView.java
│ │ │ ├── NumberView.java
│ │ │ ├── PhoneView.java
│ │ │ └── UrlView.java
│ │ └── ui/
│ │ ├── activity/
│ │ │ └── MainActivity.java
│ │ └── fragment/
│ │ ├── AddressFragment.java
│ │ ├── ColorFragment.java
│ │ ├── InternetFragment.java
│ │ ├── LoremFragment.java
│ │ ├── NameFragment.java
│ │ ├── NumberFragment.java
│ │ ├── PhoneFragment.java
│ │ ├── ProfileFragment.java
│ │ ├── TargetViewsFragment.java
│ │ ├── UrlFragment.java
│ │ └── WidgetsFragment.java
│ └── res/
│ ├── layout/
│ │ ├── activity_with_toolbar.xml
│ │ ├── fragment_address.xml
│ │ ├── fragment_color.xml
│ │ ├── fragment_internet.xml
│ │ ├── fragment_lorem.xml
│ │ ├── fragment_name.xml
│ │ ├── fragment_number.xml
│ │ ├── fragment_phone.xml
│ │ ├── fragment_profile.xml
│ │ ├── fragment_target_views.xml
│ │ ├── fragment_url.xml
│ │ ├── fragment_widgets.xml
│ │ ├── header_drawer.xml
│ │ └── view_loading.xml
│ ├── menu/
│ │ └── menu_main.xml
│ ├── values/
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-v21/
│ │ └── styles.xml
│ └── values-w820dp/
│ └── dimens.xml
├── build.gradle
├── faker-core/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── io/
│ │ └── kimo/
│ │ └── lib/
│ │ └── faker/
│ │ └── component/
│ │ ├── number/
│ │ │ └── NumberComponentTest.java
│ │ └── text/
│ │ ├── AddressComponentTest.java
│ │ ├── InternetComponentTest.java
│ │ ├── LoremComponentTest.java
│ │ ├── NameComponentTest.java
│ │ ├── PhoneComponentTest.java
│ │ └── UrlComponentTest.java
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── io/
│ │ └── kimo/
│ │ └── lib/
│ │ └── faker/
│ │ ├── Faker.java
│ │ ├── FakerCoreComponent.java
│ │ ├── api/
│ │ │ ├── AddressAPI.java
│ │ │ ├── ColorAPI.java
│ │ │ ├── InternetAPI.java
│ │ │ ├── LoremAPI.java
│ │ │ ├── NameAPI.java
│ │ │ ├── NumberAPI.java
│ │ │ ├── PhoneAPI.java
│ │ │ └── UrlAPI.java
│ │ └── component/
│ │ ├── FakerColorComponent.java
│ │ ├── FakerNumericComponent.java
│ │ ├── FakerTextComponent.java
│ │ ├── number/
│ │ │ ├── ColorComponent.java
│ │ │ └── NumberComponent.java
│ │ └── text/
│ │ ├── AddressComponent.java
│ │ ├── InternetComponent.java
│ │ ├── LoremComponent.java
│ │ ├── NameComponent.java
│ │ ├── PhoneComponent.java
│ │ └── URLComponent.java
│ └── res/
│ └── values/
│ ├── address.xml
│ ├── internet.xml
│ ├── lorem.xml
│ ├── names.xml
│ ├── phones.xml
│ └── strings.xml
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── maven_push.gradle
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
# Gradle files
.gradle/
build/
/*/build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
*.iml
.idea/
.DS_Store
================================================
FILE: .travis.yml
================================================
language: android
jdk: oraclejdk7
env:
global:
- ADB_INSTALL_TIMEOUT=8
env:
matrix:
- ANDROID_TARGET=10 ANDROID_ABI=default/armeabi
- ANDROID_TARGET=21 ANDROID_ABI=default/armeabi-v7a
android:
components:
- android-22
- build-tools-22.0.1
- extra-android-m2repository
before_script:
- echo no | android create avd --force -n test -t android-$ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew clean assemble -PdisablePreDex -q
- ./gradlew connectedAndroidTest
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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 at
http://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.
================================================
FILE: README.md
================================================
# 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.iohttps://jitpack.io
```
``` xml
com.github.thiagokimofakerVERSION
```
## 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-request
Make 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 Rocha
Licensed 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 at
http://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.
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "io.kimo.faker"
minSdkVersion 14
targetSdkVersion 22
versionCode 8
versionName "1.0.7"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile('com.mikepenz:materialdrawer:3.0.8@aar') { transitive = true }
compile('com.mikepenz:aboutlibraries:5.0.5@aar') { transitive = true }
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':faker-core')
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/Kimo/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
================================================
FILE: app/src/main/java/io/kimo/faker/FakerApp.java
================================================
package io.kimo.faker;
import android.app.Application;
public class FakerApp extends Application {
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/BasePresenter.java
================================================
package io.kimo.faker.mvp;
import android.content.Context;
public abstract class BasePresenter implements Presenter {
protected View view;
protected Context context;
public BasePresenter(View view, Context context) {
this.view = view;
this.context = context;
}
@Override
public void createView() {
hideAllViews();
view.showLoading();
configureMainView();
view.hideLoading();
view.showView();
}
public void hideAllViews() {
view.hideView();
view.hideLoading();
}
public abstract void configureMainView();
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/BaseView.java
================================================
package io.kimo.faker.mvp;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public abstract class BaseView extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(getLayoutResource(), container, false);
mapGUI(view);
configureGUI();
return view;
}
@Override
public void onStart() {
super.onStart();
startPresenter();
}
@Override
public void onStop() {
super.onStop();
stopPresenter();
}
public abstract int getLayoutResource();
public abstract void mapGUI(View view);
public abstract void configureGUI();
public abstract void startPresenter();
public abstract void stopPresenter();
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/Presenter.java
================================================
package io.kimo.faker.mvp;
public interface Presenter {
void createView();
void destroyView();
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/View.java
================================================
package io.kimo.faker.mvp;
public interface View {
void showFeedback(String msg);
void showView();
void hideView();
void showLoading();
void hideLoading();
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/AddressPresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.AddressView;
import io.kimo.lib.faker.Faker;
public class AddressPresenter extends BasePresenter{
public AddressPresenter(AddressView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
AddressView addressView = (AddressView) view;
addressView.updateCityExample(Faker.with(context).Address.city());
addressView.updateStreetExample(Faker.with(context).Address.street());
addressView.updateSecondaryAddressExample(Faker.with(context).Address.secondaryAddress());
addressView.updateZipcodeExample(Faker.with(context).Address.zipCode());
addressView.updateTimezoneExample(Faker.with(context).Address.timeZone());
addressView.updateCityPrefixExample(Faker.with(context).Address.cityPrefix());
addressView.updateCitySuffixExample(Faker.with(context).Address.citySuffix());
addressView.updateStateExample(Faker.with(context).Address.state());
addressView.updateStateAbbrvExample(Faker.with(context).Address.stateAbbreviation());
addressView.updateCountryExample(Faker.with(context).Address.country());
addressView.updateCountryAbbrvExample(Faker.with(context).Address.countryAbbreviation());
addressView.updateLatitudeExample(Faker.with(context).Address.latitude());
addressView.updateLongitudeExample(Faker.with(context).Address.longitude());
}
@Override
public void destroyView() {
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/ColorPresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.ColorView;
import io.kimo.lib.faker.Faker;
public class ColorPresenter extends BasePresenter{
public ColorPresenter(ColorView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
ColorView colorView = (ColorView) view;
colorView.updateRandomColorExample(Faker.with(context).Color.randomColor());
colorView.updateRedColorExample(Faker.with(context).Color.redColor());
colorView.updateGreenColorExample(Faker.with(context).Color.greenColor());
colorView.updateBlueColorExample(Faker.with(context).Color.blueColor());
colorView.updateMonochromeColorExample(Faker.with(context).Color.monochromeColor());
colorView.updateBrightColorExample(Faker.with(context).Color.brightColor());
colorView.updateDarkColorExample(Faker.with(context).Color.darkColor());
colorView.updateLightColorExample(Faker.with(context).Color.lightColor());
}
@Override
public void destroyView() {
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/InternetPresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.InternetView;
import io.kimo.lib.faker.Faker;
public class InternetPresenter extends BasePresenter{
public InternetPresenter(InternetView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
InternetView internetView = (InternetView) view;
internetView.updateEmailExample(Faker.with(context).Internet.email());
internetView.updateURLExample(Faker.with(context).Internet.url());
internetView.updateDomainExample(Faker.with(context).Internet.domain());
internetView.updateDomainSuffixExample(Faker.with(context).Internet.domainSuffix());
}
@Override
public void destroyView() {}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/LoremPresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.LoremView;
import io.kimo.lib.faker.Faker;
public class LoremPresenter extends BasePresenter {
public LoremPresenter(LoremView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
LoremView loremView = (LoremView) view;
loremView.updateCharacterExample(Faker.with(context).Lorem.character());
loremView.updateCharactersExample(Faker.with(context).Lorem.characters());
loremView.updateWordExample(Faker.with(context).Lorem.word());
loremView.updateWordsExample(Faker.with(context).Lorem.words());
loremView.updateSentenceExample(Faker.with(context).Lorem.sentence());
loremView.updateSentencesExample(Faker.with(context).Lorem.sentences());
loremView.updateParagraphExample(Faker.with(context).Lorem.paragraph());
loremView.updateParagraphsExample(Faker.with(context).Lorem.paragraphs());
}
@Override
public void destroyView() {}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/NamePresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.NameView;
import io.kimo.lib.faker.Faker;
public class NamePresenter extends BasePresenter {
public NamePresenter(NameView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
NameView nameView = (NameView) view;
nameView.updateCompleteNameExample(Faker.with(context).Name.completeName());
nameView.updateFullNameExample(Faker.with(context).Name.fullName());
nameView.updateFirstNameExample(Faker.with(context).Name.firstName());
nameView.updateLastNameExample(Faker.with(context).Name.lastName());
nameView.updatePrefixExample(Faker.with(context).Name.prefix());
nameView.updateSuffixExample(Faker.with(context).Name.suffix());
nameView.updateTitleExample(Faker.with(context).Name.title());
}
@Override
public void destroyView() {}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/NumberPresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.NumberView;
import io.kimo.lib.faker.Faker;
public class NumberPresenter extends BasePresenter {
public NumberPresenter(NumberView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
NumberView numberView = (NumberView) view;
numberView.updateDigit(Faker.with(context).Number.digit());
numberView.updatePositiveDigit(Faker.with(context).Number.positiveDigit());
numberView.updateNegativeDigit(Faker.with(context).Number.negativeDigit());
numberView.updateNumbers(Faker.with(context).Number.number());
numberView.updatePositiveNumbers(Faker.with(context).Number.positiveNumber());
numberView.updateNegativeNumbers(Faker.with(context).Number.negativeNumber());
}
@Override
public void destroyView() {}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/PhonePresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.View;
import io.kimo.faker.mvp.view.PhoneView;
import io.kimo.lib.faker.Faker;
public class PhonePresenter extends BasePresenter {
public PhonePresenter(View view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
PhoneView phoneView = (PhoneView) view;
phoneView.updatePhoneWithAreaCodeExample(Faker.with(context).Phone.phoneWithAreaCode());
phoneView.updatePhoneWithCountryCodeExample(Faker.with(context).Phone.phoneWithCountryCode());
}
@Override
public void destroyView() {}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/presenter/UrlPresenter.java
================================================
package io.kimo.faker.mvp.presenter;
import android.content.Context;
import io.kimo.faker.mvp.BasePresenter;
import io.kimo.faker.mvp.view.UrlView;
import io.kimo.lib.faker.Faker;
public class UrlPresenter extends BasePresenter{
public UrlPresenter(UrlView view, Context context) {
super(view, context);
}
@Override
public void configureMainView() {
UrlView urlView = (UrlView) view;
urlView.updateImageUrlExample(Faker.with(context).Url.image());
urlView.updateAvatarUrlExample(Faker.with(context).Url.avatar());
}
@Override
public void destroyView() {
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/AddressView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface AddressView extends View {
void updateCityExample(String value);
void updateStreetExample(String value);
void updateSecondaryAddressExample(String value);
void updateZipcodeExample(String value);
void updateTimezoneExample(String value);
void updateCityPrefixExample(String value);
void updateCitySuffixExample(String value);
void updateStateExample(String value);
void updateStateAbbrvExample(String value);
void updateCountryExample(String value);
void updateCountryAbbrvExample(String value);
void updateLatitudeExample(String value);
void updateLongitudeExample(String value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/ColorView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface ColorView extends View {
void updateRandomColorExample(int color);
void updateRedColorExample(int color);
void updateGreenColorExample(int color);
void updateBlueColorExample(int color);
void updateMonochromeColorExample(int color);
void updateBrightColorExample(int color);
void updateLightColorExample(int color);
void updateDarkColorExample(int color);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/InternetView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface InternetView extends View {
void updateEmailExample(String value);
void updateURLExample(String value);
void updateDomainExample(String value);
void updateDomainSuffixExample(String value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/LoremView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface LoremView extends View {
void updateCharacterExample(String value);
void updateCharactersExample(String value);
void updateWordExample(String value);
void updateWordsExample(String value);
void updateSentenceExample(String value);
void updateSentencesExample(String value);
void updateParagraphExample(String value);
void updateParagraphsExample(String value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/NameView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface NameView extends View {
void updateCompleteNameExample(String value);
void updateFullNameExample(String value);
void updateFirstNameExample(String value);
void updateLastNameExample(String value);
void updatePrefixExample(String value);
void updateSuffixExample(String value);
void updateTitleExample(String value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/NumberView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface NumberView extends View {
void updateDigit(int value);
void updatePositiveDigit(int value);
void updateNegativeDigit(int value);
void updateNumbers(int value);
void updatePositiveNumbers(int value);
void updateNegativeNumbers(int value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/PhoneView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface PhoneView extends View {
void updatePhoneWithAreaCodeExample(String value);
void updatePhoneWithCountryCodeExample(String value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/mvp/view/UrlView.java
================================================
package io.kimo.faker.mvp.view;
import io.kimo.faker.mvp.View;
public interface UrlView extends View {
void updateImageUrlExample(String value);
void updateAvatarUrlExample(String value);
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/activity/MainActivity.java
================================================
package io.kimo.faker.ui.activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ScrollView;
import com.mikepenz.aboutlibraries.Libs;
import com.mikepenz.aboutlibraries.LibsBuilder;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.SectionDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import io.kimo.faker.R;
import io.kimo.faker.ui.fragment.AddressFragment;
import io.kimo.faker.ui.fragment.ColorFragment;
import io.kimo.faker.ui.fragment.InternetFragment;
import io.kimo.faker.ui.fragment.LoremFragment;
import io.kimo.faker.ui.fragment.NameFragment;
import io.kimo.faker.ui.fragment.NumberFragment;
import io.kimo.faker.ui.fragment.PhoneFragment;
import io.kimo.faker.ui.fragment.ProfileFragment;
import io.kimo.faker.ui.fragment.TargetViewsFragment;
import io.kimo.faker.ui.fragment.UrlFragment;
import io.kimo.faker.ui.fragment.WidgetsFragment;
public class MainActivity extends AppCompatActivity {
public static final int LOREM_FRAGMENT = 0;
public static final int NAME_FRAGMENT = 1;
public static final int NUMBER_FRAGMENT = 2;
public static final int PHONE_FRAGMENT = 3;
public static final int INTERNET_FRAGMENT = 4;
public static final int URL_FRAGMENT = 5;
public static final int PROFILE_FRAGMENT = 6;
public static final int RANDOM_WIDGETS_FRAGMENT = 7;
public static final int COLOR_FRAGMENT = 8;
public static final int ADDRESS_FRAGMENT = 9;
public static final int TARGET_VIEWS_FRAGMENT = 10;
private Toolbar toolbar;
private Drawer drawer;
private ScrollView scrollView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_with_toolbar);
configureToolbar();
configureDrawer(savedInstanceState);
if(savedInstanceState == null) {
showFragment(RANDOM_WIDGETS_FRAGMENT);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
MenuItem menuItem = menu.findItem(R.id.action_about);
menuItem.setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_info_outline).actionBar().color(Color.WHITE));
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_about:
new LibsBuilder()
.withFields(R.string.class.getFields())
.withAutoDetect(true)
.withAboutIconShown(true)
.withAboutVersionShownName(true)
.withAboutAppName("Faker")
.withAboutDescription("Provides fake data to your Android apps.")
.withActivityTitle("About")
.withActivityTheme(R.style.AppTheme)
.withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
.start(this);
return true;
}
return super.onOptionsItemSelected(item);
}
private void configureToolbar() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
if(toolbar != null) {
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
private void configureDrawer(Bundle savedInstanceState) {
drawer = new DrawerBuilder()
.withActivity(this)
.withHeader(R.layout.header_drawer)
.withToolbar(toolbar)
.withTranslucentStatusBar(true)
.addDrawerItems(
new PrimaryDrawerItem().withName("Random data").withIdentifier(RANDOM_WIDGETS_FRAGMENT),
new PrimaryDrawerItem().withName("Target views").withIdentifier(TARGET_VIEWS_FRAGMENT),
new PrimaryDrawerItem().withName("\"Specific\" random data").withIdentifier(PROFILE_FRAGMENT),
new SectionDrawerItem().withName("FAKER COMPONENTS"),
new PrimaryDrawerItem()
.withName("Lorem")
.withIcon(GoogleMaterial.Icon.gmd_text_format)
.withIconTintingEnabled(true)
.withIdentifier(LOREM_FRAGMENT),
new PrimaryDrawerItem()
.withName("Name")
.withIcon(GoogleMaterial.Icon.gmd_person)
.withIconTintingEnabled(true)
.withIdentifier(NAME_FRAGMENT),
new PrimaryDrawerItem()
.withName("Number")
.withIcon(GoogleMaterial.Icon.gmd_filter_9_plus)
.withIconTintingEnabled(true)
.withIdentifier(NUMBER_FRAGMENT),
new PrimaryDrawerItem()
.withName("Phone")
.withIcon(GoogleMaterial.Icon.gmd_call)
.withIconTintingEnabled(true)
.withIdentifier(PHONE_FRAGMENT),
new PrimaryDrawerItem()
.withName("Internet")
.withIcon(GoogleMaterial.Icon.gmd_public)
.withIconTintingEnabled(true)
.withIdentifier(INTERNET_FRAGMENT),
new PrimaryDrawerItem()
.withName("Url")
.withIcon(GoogleMaterial.Icon.gmd_photo)
.withIconTintingEnabled(true)
.withIdentifier(URL_FRAGMENT),
new PrimaryDrawerItem()
.withName("Color")
.withIcon(GoogleMaterial.Icon.gmd_invert_colors)
.withIconTintingEnabled(true)
.withIdentifier(COLOR_FRAGMENT),
new PrimaryDrawerItem()
.withName("Address")
.withIcon(GoogleMaterial.Icon.gmd_home)
.withIconTintingEnabled(true)
.withIdentifier(ADDRESS_FRAGMENT)
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(AdapterView> adapterView, View view, int i, long l, IDrawerItem iDrawerItem) {
if (iDrawerItem != null) {
showFragment(iDrawerItem.getIdentifier());
}
return false;
}
})
.withSelectedItem(0)
.withSavedInstance(savedInstanceState)
.build();
}
@Override
public void onBackPressed() {
if(drawer != null && drawer.isDrawerOpen()) {
drawer.closeDrawer();
} else {
super.onBackPressed();
}
}
private void showFragment(int flag) {
switch (flag) {
case LOREM_FRAGMENT:
replace(LoremFragment.newInstance());
break;
case NAME_FRAGMENT:
replace(NameFragment.newInstance());
break;
case NUMBER_FRAGMENT:
replace(NumberFragment.newInstance());
break;
case PHONE_FRAGMENT:
replace(PhoneFragment.newInstance());
break;
case INTERNET_FRAGMENT:
replace(InternetFragment.newInstance());
break;
case URL_FRAGMENT:
replace(UrlFragment.newInstance());
break;
case PROFILE_FRAGMENT:
replace(new ProfileFragment());
break;
case RANDOM_WIDGETS_FRAGMENT:
replace(new WidgetsFragment());
break;
case COLOR_FRAGMENT:
replace(ColorFragment.newInstance());
break;
case ADDRESS_FRAGMENT:
replace(AddressFragment.newInstance());
break;
case TARGET_VIEWS_FRAGMENT:
replace(new TargetViewsFragment());
break;
}
}
private void replace(Fragment fragment) {
if(scrollView == null) {
scrollView = (ScrollView) findViewById(R.id.container);
}
scrollView.fullScroll(ScrollView.FOCUS_UP);
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, fragment)
.commit();
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/AddressFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.AddressPresenter;
import io.kimo.faker.mvp.view.AddressView;
public class AddressFragment extends BaseView implements AddressView {
private AddressPresenter presenter;
private View mainView, loadingView;
private TextView city, street, secondaryAddress, zipcode, timezone, cityPrefix, citySuffix, state, stateAbbrv, country, countryAbbrv, latitude, longitude;
public static AddressFragment newInstance() {
return new AddressFragment();
}
@Override
public void updateCityExample(String value) {
city.setText(value);
}
@Override
public void updateStreetExample(String value) {
street.setText(value);
}
@Override
public void updateSecondaryAddressExample(String value) {
secondaryAddress.setText(value);
}
@Override
public void updateZipcodeExample(String value) {
zipcode.setText(value);
}
@Override
public void updateTimezoneExample(String value) {
timezone.setText(value);
}
@Override
public void updateCityPrefixExample(String value) {
cityPrefix.setText(value);
}
@Override
public void updateCitySuffixExample(String value) {
citySuffix.setText(value);
}
@Override
public void updateStateExample(String value) {
state.setText(value);
}
@Override
public void updateStateAbbrvExample(String value) {
stateAbbrv.setText(value);
}
@Override
public void updateCountryExample(String value) {
country.setText(value);
}
@Override
public void updateCountryAbbrvExample(String value) {
countryAbbrv.setText(value);
}
@Override
public void updateLatitudeExample(String value) {
latitude.setText(value);
}
@Override
public void updateLongitudeExample(String value) {
longitude.setText(value);
}
@Override
public int getLayoutResource() {
return R.layout.fragment_address;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
city = (TextView) mainView.findViewById(R.id.city);
street = (TextView) mainView.findViewById(R.id.street);
secondaryAddress = (TextView) mainView.findViewById(R.id.secondary_address);
zipcode = (TextView) mainView.findViewById(R.id.zipcode);
timezone = (TextView) mainView.findViewById(R.id.timezone);
cityPrefix = (TextView) mainView.findViewById(R.id.city_prefix);
citySuffix = (TextView) mainView.findViewById(R.id.city_suffix);
state = (TextView) mainView.findViewById(R.id.state);
stateAbbrv = (TextView) mainView.findViewById(R.id.state_abbrv);
country = (TextView) mainView.findViewById(R.id.country);
countryAbbrv = (TextView) mainView.findViewById(R.id.country_abbrv);
latitude = (TextView) mainView.findViewById(R.id.latitude);
longitude = (TextView) mainView.findViewById(R.id.longitude);
}
@Override
public void configureGUI() {
getActivity().setTitle("Address");
}
@Override
public void startPresenter() {
presenter = new AddressPresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/ColorFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.ColorPresenter;
import io.kimo.faker.mvp.view.ColorView;
public class ColorFragment extends BaseView implements ColorView {
private View mainView, loadingView, random, red, green, blue, monochrome, bright, dark, light;
private ColorPresenter presenter;
public static ColorFragment newInstance() {
return new ColorFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_color;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
random = view.findViewById(R.id.random_color);
red = view.findViewById(R.id.red_color);
green = view.findViewById(R.id.green_color);
blue = view.findViewById(R.id.blue_color);
monochrome = view.findViewById(R.id.monochrome_color);
bright = view.findViewById(R.id.bright_color);
dark = view.findViewById(R.id.dark_color);
light = view.findViewById(R.id.light_color);
}
@Override
public void configureGUI() {
getActivity().setTitle("Color");
}
@Override
public void startPresenter() {
presenter = new ColorPresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void updateRandomColorExample(int color) {
random.setBackgroundColor(color);
}
@Override
public void updateRedColorExample(int color) {
red.setBackgroundColor(color);
}
@Override
public void updateGreenColorExample(int color) {
green.setBackgroundColor(color);
}
@Override
public void updateBlueColorExample(int color) {
blue.setBackgroundColor(color);
}
@Override
public void updateMonochromeColorExample(int color) {
monochrome.setBackgroundColor(color);
}
@Override
public void updateBrightColorExample(int color) {
bright.setBackgroundColor(color);
}
@Override
public void updateLightColorExample(int color) {
light.setBackgroundColor(color);
}
@Override
public void updateDarkColorExample(int color) {
dark.setBackgroundColor(color);
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/InternetFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.InternetPresenter;
import io.kimo.faker.mvp.view.InternetView;
public class InternetFragment extends BaseView implements InternetView {
private View mainView, loadingView;
private TextView email, url, domain, domainSuffix;
private InternetPresenter presenter;
public static InternetFragment newInstance() {
return new InternetFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_internet;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
email = (TextView) view.findViewById(R.id.email);
url = (TextView) view.findViewById(R.id.url);
domain = (TextView) view.findViewById(R.id.domain);
domainSuffix = (TextView) view.findViewById(R.id.domain_suffix);
}
@Override
public void configureGUI() {
getActivity().setTitle("Internet");
}
@Override
public void startPresenter() {
presenter = new InternetPresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void updateEmailExample(String value) {
email.setText(value);
}
@Override
public void updateURLExample(String value) {
url.setText(value);
}
@Override
public void updateDomainExample(String value) {
domain.setText(value);
}
@Override
public void updateDomainSuffixExample(String value) {
domainSuffix.setText(value);
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/LoremFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.LoremPresenter;
import io.kimo.faker.mvp.view.LoremView;
public class LoremFragment extends BaseView implements LoremView {
private View mainView, loadingView;
private TextView character, characters, word, words, sentence, sentences, paragraph, paragraphs;
private LoremPresenter presenter;
public static LoremFragment newInstance() {
return new LoremFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_lorem;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
character = (TextView) view.findViewById(R.id.lorem_character);
characters = (TextView) view.findViewById(R.id.lorem_characters);
word = (TextView) view.findViewById(R.id.lorem_word);
words = (TextView) view.findViewById(R.id.lorem_words);
sentence = (TextView) view.findViewById(R.id.lorem_sentence);
sentences = (TextView) view.findViewById(R.id.lorem_sentences);
paragraph = (TextView) view.findViewById(R.id.lorem_paragraph);
paragraphs = (TextView) view.findViewById(R.id.lorem_paragraphs);
}
@Override
public void configureGUI() {
getActivity().setTitle("Lorem");
}
@Override
public void startPresenter() {
presenter = new LoremPresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void updateCharacterExample(String value) {
character.setText(value);
}
@Override
public void updateCharactersExample(String value) {
characters.setText(value);
}
@Override
public void updateWordExample(String value) {
word.setText(value);
}
@Override
public void updateWordsExample(String value) {
words.setText(value);
}
@Override
public void updateSentenceExample(String value) {
sentence.setText(value);
}
@Override
public void updateSentencesExample(String value) {
sentences.setText(value);
}
@Override
public void updateParagraphExample(String value) {
paragraph.setText(value);
}
@Override
public void updateParagraphsExample(String value) {
paragraphs.setText(value);
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/NameFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.NamePresenter;
import io.kimo.faker.mvp.view.NameView;
public class NameFragment extends BaseView implements NameView {
private View mainView, loadingView;
private TextView completeName, fullName, firstName, lastName, prefix, suffix, title;
private NamePresenter presenter;
public static NameFragment newInstance() {
return new NameFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_name;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
completeName = (TextView) view.findViewById(R.id.complete_name);
fullName = (TextView) view.findViewById(R.id.full_name);
firstName = (TextView) view.findViewById(R.id.first_name);
lastName = (TextView) view.findViewById(R.id.last_name);
prefix = (TextView) view.findViewById(R.id.prefix);
suffix = (TextView) view.findViewById(R.id.suffix);
title = (TextView) view.findViewById(R.id.title);
}
@Override
public void configureGUI() {
getActivity().setTitle("Name");
}
@Override
public void startPresenter() {
presenter = new NamePresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
@Override
public void updateCompleteNameExample(String value) {
completeName.setText(value);
}
@Override
public void updateFullNameExample(String value) {
fullName.setText(value);
}
@Override
public void updateFirstNameExample(String value) {
firstName.setText(value);
}
@Override
public void updateLastNameExample(String value) {
lastName.setText(value);
}
@Override
public void updatePrefixExample(String value) {
prefix.setText(value);
}
@Override
public void updateSuffixExample(String value) {
suffix.setText(value);
}
@Override
public void updateTitleExample(String value) {
title.setText(value);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/NumberFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.NumberPresenter;
import io.kimo.faker.mvp.view.NumberView;
public class NumberFragment extends BaseView implements NumberView {
private View mainView, loadingView;
private TextView digit, positiveDigit, negativeDigit, numbers, positiveNumbers, negativeNumbers;
private NumberPresenter presenter;
public static NumberFragment newInstance() {
return new NumberFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_number;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
digit = (TextView) view.findViewById(R.id.digit);
positiveDigit = (TextView) view.findViewById(R.id.positive_digit);
negativeDigit = (TextView) view.findViewById(R.id.negative_digit);
numbers = (TextView) view.findViewById(R.id.number);
positiveNumbers = (TextView) view.findViewById(R.id.positive_number);
negativeNumbers = (TextView) view.findViewById(R.id.negative_number);
}
@Override
public void configureGUI() {
getActivity().setTitle("Numbers");
}
@Override
public void startPresenter() {
presenter = new NumberPresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
@Override
public void updateDigit(int value) {
digit.setText(String.valueOf(value));
}
@Override
public void updatePositiveDigit(int value) {
positiveDigit.setText(String.valueOf(value));
}
@Override
public void updateNegativeDigit(int value) {
negativeDigit.setText(String.valueOf(value));
}
@Override
public void updateNumbers(int value) {
numbers.setText(String.valueOf(value));
}
@Override
public void updatePositiveNumbers(int value) {
positiveNumbers.setText(String.valueOf(value));
}
@Override
public void updateNegativeNumbers(int value) {
negativeNumbers.setText(String.valueOf(value));
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/PhoneFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.PhonePresenter;
import io.kimo.faker.mvp.view.PhoneView;
public class PhoneFragment extends BaseView implements PhoneView {
private View mainView, loadingView;
private TextView areaCode, countryCode;
private PhonePresenter presenter;
public static PhoneFragment newInstance() {
return new PhoneFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_phone;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
areaCode = (TextView) view.findViewById(R.id.area_code_phone);
countryCode = (TextView) view.findViewById(R.id.country_code_phone);
}
@Override
public void configureGUI() {
getActivity().setTitle("Phone");
}
@Override
public void startPresenter() {
presenter = new PhonePresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void updatePhoneWithAreaCodeExample(String value) {
areaCode.setText(value);
}
@Override
public void updatePhoneWithCountryCodeExample(String value) {
countryCode.setText(value);
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/ProfileFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import io.kimo.faker.R;
import io.kimo.lib.faker.Faker;
public class ProfileFragment extends Fragment {
private ImageView image;
private TextView name, title, website, email, phone;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_profile, container, false);
image = (ImageView) view.findViewById(R.id.image);
name = (TextView) view.findViewById(R.id.name);
title = (TextView) view.findViewById(R.id.title);
website = (TextView) view.findViewById(R.id.website);
email = (TextView) view.findViewById(R.id.email);
phone = (TextView) view.findViewById(R.id.phone);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Picasso.with(getActivity())
.load(Faker.with(getActivity()).Url.avatar())
.placeholder(R.drawable.drawer_background)
.error(R.drawable.drawer_background)
.into(image);
name.setText(Faker.with(getActivity()).Name.fullName());
title.setText(Faker.with(getActivity()).Name.title());
website.setText(Faker.with(getActivity()).Internet.url());
email.setText(Faker.with(getActivity()).Internet.email());
phone.setText(Faker.with(getActivity()).Phone.phoneWithAreaCode());
getActivity().setTitle("\"Specific\" Random Data");
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/TargetViewsFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import io.kimo.faker.R;
import io.kimo.lib.faker.Faker;
public class TargetViewsFragment extends Fragment {
View rootView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_target_views, container, false);
return rootView;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().setTitle("Target Views");
Faker.with(getActivity())
.targetViews(R.id.text, R.id.image, R.id.button)
.fill(rootView);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/UrlFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.MemoryPolicy;
import com.squareup.picasso.Picasso;
import io.kimo.faker.R;
import io.kimo.faker.mvp.BaseView;
import io.kimo.faker.mvp.presenter.UrlPresenter;
import io.kimo.faker.mvp.view.UrlView;
public class UrlFragment extends BaseView implements UrlView {
private View mainView, loadingView;
private TextView imageUrl, avatarUrl;
private ImageView image, avatar;
private UrlPresenter presenter;
public static UrlFragment newInstance() {
return new UrlFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_url;
}
@Override
public void mapGUI(View view) {
mainView = view.findViewById(R.id.main_container);
loadingView = view.findViewById(R.id.view_loading);
imageUrl = (TextView) view.findViewById(R.id.image_url);
image = (ImageView) view.findViewById(R.id.image);
avatarUrl = (TextView) view.findViewById(R.id.avatar_url);
avatar = (ImageView) view.findViewById(R.id.avatar);
}
@Override
public void configureGUI() {
getActivity().setTitle("Url");
}
@Override
public void startPresenter() {
presenter = new UrlPresenter(this, getActivity());
presenter.createView();
}
@Override
public void stopPresenter() {
presenter.destroyView();
}
@Override
public void updateImageUrlExample(String value) {
Picasso.with(getActivity())
.load(value)
.memoryPolicy(MemoryPolicy.NO_CACHE)
.placeholder(R.drawable.drawer_background)
.error(R.drawable.drawer_background)
.into(image);
imageUrl.setText(value);
}
@Override
public void updateAvatarUrlExample(String value) {
Picasso.with(getActivity())
.load(value)
.memoryPolicy(MemoryPolicy.NO_CACHE)
.placeholder(R.drawable.drawer_background)
.error(R.drawable.drawer_background)
.into(avatar);
avatarUrl.setText(value);
}
@Override
public void showFeedback(String msg) {
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}
@Override
public void showView() {
mainView.setVisibility(View.VISIBLE);
}
@Override
public void hideView() {
mainView.setVisibility(View.GONE);
}
@Override
public void showLoading() {
loadingView.setVisibility(View.VISIBLE);
}
@Override
public void hideLoading() {
loadingView.setVisibility(View.GONE);
}
}
================================================
FILE: app/src/main/java/io/kimo/faker/ui/fragment/WidgetsFragment.java
================================================
package io.kimo.faker.ui.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import io.kimo.faker.R;
import io.kimo.lib.faker.Faker;
public class WidgetsFragment extends Fragment {
private View rootView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_widgets, container, false);
return rootView;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().setTitle("Random Data");
Faker.with(getActivity()).fill(rootView);
}
}
================================================
FILE: app/src/main/res/layout/activity_with_toolbar.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_address.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_color.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_internet.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_lorem.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_name.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_number.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_phone.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_profile.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_target_views.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_url.xml
================================================
================================================
FILE: app/src/main/res/layout/fragment_widgets.xml
================================================
================================================
FILE: app/src/main/res/layout/header_drawer.xml
================================================
================================================
FILE: app/src/main/res/layout/view_loading.xml
================================================
================================================
FILE: app/src/main/res/menu/menu_main.xml
================================================
================================================
FILE: app/src/main/res/values/colors.xml
================================================
#FF9800#F57C00#03A9F4
================================================
FILE: app/src/main/res/values/dimens.xml
================================================
16dp16dp
================================================
FILE: app/src/main/res/values/strings.xml
================================================
FakerOpenClose
================================================
FILE: app/src/main/res/values/styles.xml
================================================
================================================
FILE: app/src/main/res/values-v21/styles.xml
================================================
================================================
FILE: app/src/main/res/values-w820dp/dimens.xml
================================================
64dp
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
================================================
FILE: faker-core/.gitignore
================================================
/build
================================================
FILE: faker-core/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion '26.0.1'
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
versionName "1.4.4"
versionCode 10
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile ('com.github.lzyzsd.randomcolor:library:1.0.0') {
exclude group: "com.android.support", module: "appcompat-v7"
}
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
}
================================================
FILE: faker-core/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/Kimo/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/number/NumberComponentTest.java
================================================
package io.kimo.lib.faker.component.number;
import android.test.AndroidTestCase;
import org.junit.Before;
import org.junit.Test;
public class NumberComponentTest extends AndroidTestCase {
private NumberComponent numberComponent;
@Before
public void setUp() throws Exception {
numberComponent = new NumberComponent(getContext());
}
@Test
public void testDigit() throws Exception {
int randomDigit = numberComponent.digit();
assertTrue(randomDigit > -10 && randomDigit < 10);
}
@Test
public void testPositiveDigit() throws Exception {
int positiveDigit = numberComponent.positiveDigit();
assertTrue(positiveDigit >= 0 && positiveDigit < 10);
}
@Test
public void testNegativeDigit() throws Exception {
int negativeDigit = numberComponent.negativeDigit();
assertTrue(negativeDigit < 0 && negativeDigit > -10);
}
@Test
public void testNumbers() throws Exception {
try {
Integer.parseInt(numberComponent.number() + "");
assertTrue(true);
} catch (NumberFormatException e) {
assertTrue(false);
}
}
@Test
public void testNumbersWithArguments() throws Exception {
for(int i = 0; i < 10000; i++) {
String randomNumber = numberComponent.number(3) + "";
assertTrue(randomNumber.length() == 3);
}
}
@Test
public void testNumbersWithInvalidArguments() throws Exception {
try {
numberComponent.number(0);
assertTrue(false);
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
@Test
public void testPositiveNumbers() throws Exception {
int randomPositiveNumber = numberComponent.positiveNumber();
assertTrue(randomPositiveNumber > -1);
}
@Test
public void testNegativeNumbers() throws Exception {
int randomPositiveNumber = numberComponent.negativeNumber();
assertTrue(randomPositiveNumber < 0);
}
@Test
public void testRandomNumber() throws Exception {
assertTrue(numberComponent.randomNumber() instanceof Number);
}
}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/text/AddressComponentTest.java
================================================
package io.kimo.lib.faker.component.text;
import android.test.AndroidTestCase;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import io.kimo.lib.faker.R;
public class AddressComponentTest extends AndroidTestCase {
private AddressComponent addressComponent;
private List firstNames, lastNames, cityPrefixes, citySuffixes, streetSuffixes, secondaryAddressPrefixes, timezones, states, statesAbbrv, countries, countriesAbbrv;
@Before
public void setUp() throws Exception {
addressComponent = new AddressComponent(getContext());
firstNames = Arrays.asList(getContext().getResources().getStringArray(R.array.first_names));
lastNames = Arrays.asList(getContext().getResources().getStringArray(R.array.last_names));
cityPrefixes = Arrays.asList(getContext().getResources().getStringArray(R.array.city_prefixes));
citySuffixes = Arrays.asList(getContext().getResources().getStringArray(R.array.city_suffixes));
streetSuffixes = Arrays.asList(getContext().getResources().getStringArray(R.array.street_suffixes));
secondaryAddressPrefixes = Arrays.asList(getContext().getResources().getStringArray(R.array.secondary_address_prefixes));
timezones = Arrays.asList(getContext().getResources().getStringArray(R.array.timezone));
states = Arrays.asList(getContext().getResources().getStringArray(R.array.states));
statesAbbrv = Arrays.asList(getContext().getResources().getStringArray(R.array.states_abbrv));
countries = Arrays.asList(getContext().getResources().getStringArray(R.array.countries));
countriesAbbrv = Arrays.asList(getContext().getResources().getStringArray(R.array.countries_abbrv));
}
@Test
public void testCity() throws Exception {
for(int i = 0; i < 1000; i++) {
String city = addressComponent.city();
boolean containsFirstName = false;
boolean containsLastName = false;
boolean containsPrefix = false;
boolean containsSuffix = false;
for (String firstName : firstNames) {
if (city.contains(firstName)) {
containsFirstName = true;
}
}
for (String lastName : lastNames) {
if (city.contains(lastName)) {
containsLastName = true;
}
}
for (String prefix : cityPrefixes) {
if (city.contains(prefix)) {
containsPrefix = true;
}
}
for (String suffix : citySuffixes) {
if (city.contains(suffix)) {
containsSuffix = true;
}
}
assertTrue(containsFirstName || containsLastName);
assertTrue(containsPrefix || containsSuffix);
}
}
@Test
public void testStreet() throws Exception {
String streetName = addressComponent.street();
boolean containsFirstName = false;
boolean containsLastName = false;
boolean containsStreetSuffix = false;
for(String firstName : firstNames) {
if(streetName.contains(firstName)) {
containsFirstName = true;
}
}
for(String lastName : lastNames) {
if(streetName.contains(lastName)) {
containsLastName = true;
}
}
for(String streetSuffix : streetSuffixes) {
if(streetName.contains(streetSuffix)) {
containsStreetSuffix = true;
}
}
assertTrue( containsFirstName || containsLastName );
assertTrue( containsStreetSuffix );
}
@Test
public void testStreetWithNumber() throws Exception {
String streetNameWithNumber = addressComponent.streetWithNumber();
assertTrue(streetNameWithNumber.matches("\\d+ .+"));
}
@Test
public void testSecondaryAddress() throws Exception {
String secondaryAddress = addressComponent.secondaryAddress();
boolean containsSecondaryAddressPrefix = false;
for(String secondaryAddressPrefix : secondaryAddressPrefixes) {
if(secondaryAddress.contains(secondaryAddressPrefix)) {
containsSecondaryAddressPrefix = true;
}
}
assertTrue(containsSecondaryAddressPrefix);
}
@Test
public void testBuildingNumber() throws Exception {
String buildingNumber = addressComponent.buildingNumber();
assertTrue(buildingNumber.matches("\\d+"));
}
@Test
public void testZipCodeAndPostCode() throws Exception {
String zipCode = addressComponent.zipCode();
String postCode = addressComponent.postCode();
assertTrue(zipCode.matches("\\d{5}") || zipCode.matches("\\d{5}-\\d{4}"));
assertTrue(postCode.matches("\\d{5}") || postCode.matches("\\d{5}-\\d{4}"));
}
@Test
public void testTimeZone() throws Exception {
String randomTimezone = addressComponent.timeZone();
boolean containsTimezone = false;
for(String timezone : timezones) {
if(randomTimezone.equals(timezone)) {
containsTimezone = true;
}
}
assertTrue(containsTimezone);
}
@Test
public void testCitySuffix() throws Exception {
for(int i = 0 ; i < 1000; i++) {
assertTrue(citySuffixes.contains(addressComponent.citySuffix()));
}
}
@Test
public void testCityPrefix() throws Exception {
for(int i = 0; i < 1000; i++) {
assertTrue(cityPrefixes.contains(addressComponent.cityPrefix()));
}
}
@Test
public void testState() throws Exception {
String randomState = addressComponent.state();
boolean containsState = false;
for(String state : states) {
if(randomState.equals(state)) {
containsState = true;
}
}
assertTrue(containsState);
}
@Test
public void testStateAbbreviation() throws Exception {
String randomStateAbbrv = addressComponent.stateAbbreviation();
boolean containsStateAbbrv = false;
for(String abbrv : statesAbbrv) {
if(randomStateAbbrv.equals(abbrv)) {
containsStateAbbrv = true;
}
}
assertTrue(containsStateAbbrv);
}
@Test
public void testCountry() throws Exception {
String randomCountry = addressComponent.country();
boolean containsContry = false;
for(String country : countries) {
if(randomCountry.equals(country)) {
containsContry = true;
}
}
assertTrue(containsContry);
}
@Test
public void testCountryAbbreviation() throws Exception {
String randomCountryAbbrv = addressComponent.countryAbbreviation();
boolean containsCountryAbbrv = false;
for(String countryAbbrv : countriesAbbrv) {
if(randomCountryAbbrv.equals(countryAbbrv)) {
containsCountryAbbrv = true;
}
}
assertTrue(containsCountryAbbrv);
}
@Test
public void testLatitudeAndLongitude() throws Exception {
try {
Double.parseDouble(addressComponent.latitude());
Double.parseDouble(addressComponent.longitude());
assertTrue(true);
} catch (Exception e) {
assertTrue(false);
}
}
@Test
public void testRandomText() throws Exception {
assertTrue(addressComponent.randomText() instanceof String);
}
}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/text/InternetComponentTest.java
================================================
package io.kimo.lib.faker.component.text;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import android.webkit.URLUtil;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import io.kimo.lib.faker.R;
public class InternetComponentTest extends AndroidTestCase {
private InternetComponent internetComponent;
private NameComponent nameComponent;
private LoremComponent loremComponent;
private List domainSuffixes;
private static final String EMAIL_PATTERN =
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
@Before
public void setUp() throws Exception {
internetComponent = new InternetComponent(getContext());
nameComponent = new NameComponent(getContext());
loremComponent = new LoremComponent(getContext());
domainSuffixes = Arrays.asList(getContext().getResources().getStringArray(R.array.domain_suffixes));
}
@Test
public void testEmail() throws Exception {
for(int i = 0; i < 1000; i++) {
String randomEmail = internetComponent.email();
assertTrue(randomEmail.matches(EMAIL_PATTERN));
assertTrue(randomEmail.toLowerCase().equals(randomEmail));
}
}
@Test
public void testEmailWithArguments() throws Exception {
for(int i = 0; i < 1000; i++) {
String randomName = nameComponent.firstName().toLowerCase();
String randomDomain = nameComponent.lastName().toLowerCase();
String randomDomainSuffix = internetComponent.domainSuffix();
String randomEmail = internetComponent.email(randomName, randomDomain, randomDomainSuffix);
assertTrue(randomEmail.contains(randomName));
assertTrue(randomEmail.contains(randomDomain));
assertTrue(randomEmail.contains(randomDomainSuffix));
assertTrue(randomEmail.matches(EMAIL_PATTERN));
}
}
@Test
public void testDomainSuffix() throws Exception {
for(int i = 0; i < 1000; i++) {
assertTrue(domainSuffixes.contains(internetComponent.domainSuffix().replace(".", "")));
}
}
@Test
public void testDomainSuffixWithArguments() throws Exception {
for(int i = 0; i < 1000; i++) {
String randomSuffix = loremComponent.characters(3);
assertTrue(internetComponent.domainSuffix(randomSuffix).contains(randomSuffix));
}
}
@Test
public void testDomain() throws Exception {
for(int i = 0; i < 1000; i++) {
String randomDomain = internetComponent.domain();
assertFalse(TextUtils.isEmpty(randomDomain));
assertTrue(randomDomain.toLowerCase().equals(randomDomain));
}
}
@Test
public void testUrl() throws Exception {
for(int i = 0; i < 1000; i++) {
String randomURL = internetComponent.url();
assertTrue(URLUtil.isValidUrl(randomURL));
assertTrue(randomURL.toLowerCase().equals(randomURL));
}
}
@Test
public void testUrlWithArguments() throws Exception {
for(int i = 0; i < 1000; i++) {
String randomDomain = internetComponent.domain();
String randomSuffix = internetComponent.domainSuffix();
String randomURL = internetComponent.url(randomDomain, randomSuffix);
assertTrue(randomURL.contains(randomDomain));
assertTrue(randomURL.contains(randomSuffix));
}
}
@Test
public void testRandomText() throws Exception {
assertTrue(!TextUtils.isEmpty(internetComponent.randomText()));
}
}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/text/LoremComponentTest.java
================================================
package io.kimo.lib.faker.component.text;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.component.text.LoremComponent;
public class LoremComponentTest extends AndroidTestCase {
private LoremComponent loremComponent;
private List loremWords;
private int positiveRandom;
private String alphaNumericRegex = "^[a-zA-Z0-9]*$";
@Before
public void setUp() throws Exception {
loremComponent = new LoremComponent(getContext());
loremWords = Arrays.asList(getContext().getResources().getStringArray(R.array.lorem_words));
positiveRandom = new Random().nextInt(31) + 1;
}
@Test
public void testWord() throws Exception {
assertTrue(loremWords.contains(loremComponent.word()));
}
@Test
public void testWords() throws Exception {
List randomWords = Arrays.asList(loremComponent.words().split(" "));
for(String word : randomWords) {
assertTrue(loremWords.contains(word));
}
}
@Test
public void testWordsWithArguments() throws Exception {
List randomWords = Arrays.asList(loremComponent.words(positiveRandom).split(" "));
assertTrue(randomWords.size() == positiveRandom);
}
@Test
public void testWordsWithInvalidArguments() throws Exception {
try {
loremComponent.words(0);
assertTrue(false);
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
@Test
public void testSentence() throws Exception {
String randomSentence = loremComponent.sentence();
char firstCharacter = randomSentence.charAt(0);
char lastCharacter = randomSentence.charAt(randomSentence.length()-1);
assertTrue(Character.isUpperCase(firstCharacter));
assertTrue(lastCharacter == '.');
}
@Test
public void testSentences() throws Exception {
String randomSentences = loremComponent.sentences();
assertTrue(randomSentences.split("\\. ").length > 1);
}
@Test
public void testSentencesWithArguments() throws Exception{
List randomSentences = Arrays.asList(loremComponent.sentences(positiveRandom).split("\\."));
assertTrue(randomSentences.size() == positiveRandom);
}
@Test
public void testSentencesWithInvalidArguments() throws Exception{
try {
loremComponent.sentences(0);
assertTrue(false);
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
@Test
public void testCharacter() throws Exception {
String randomCharacter = loremComponent.character();
assertTrue(randomCharacter.length() == 1);
assertTrue(randomCharacter.matches(alphaNumericRegex));
}
@Test
public void testCharacters() throws Exception {
String randomCharacters = loremComponent.characters();
assertTrue(randomCharacters.length() == 255);
assertTrue(randomCharacters.matches(alphaNumericRegex));
}
@Test
public void testCharactersWithArguments() throws Exception {
String randomCharacters = loremComponent.characters(positiveRandom);
assertTrue(randomCharacters.length() == positiveRandom);
}
@Test
public void testCharactersInvalidArguments() throws Exception {
try {
loremComponent.characters(0);
assertTrue(false);
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
@Test
public void testParagraph() throws Exception {
String paragraph = loremComponent.paragraph();
String [] numberOfSentences = paragraph.split("\\. ");
assertTrue(numberOfSentences.length >= 3);
}
@Test
public void testParagraphs() throws Exception {
String paragraphs = loremComponent.paragraphs();
assertTrue(paragraphs.contains("\n"));
}
@Test
public void testParagraphsWithArguments() throws Exception {
String paragraphs = loremComponent.paragraphs(positiveRandom);
int numberOfWhiteLines = paragraphs.split("\n").length;
assertTrue(numberOfWhiteLines == positiveRandom);
}
@Test
public void testParagraphsWithInvalidArguments() throws Exception {
try {
loremComponent.paragraphs(0);
assertTrue(false);
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
@Test
public void testRandomText() throws Exception {
assertTrue(!TextUtils.isEmpty(loremComponent.randomText()));
}
}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/text/NameComponentTest.java
================================================
package io.kimo.lib.faker.component.text;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.component.text.NameComponent;
public class NameComponentTest extends AndroidTestCase {
private NameComponent nameComponent;
private List firstNames, lastNames, prefixes, suffixes, titleDescriptions, titleLevels, titleJobs;
@Before
public void setUp() throws Exception {
nameComponent = new NameComponent(getContext());
firstNames = Arrays.asList(getContext().getResources().getStringArray(R.array.first_names));
lastNames = Arrays.asList(getContext().getResources().getStringArray(R.array.last_names));
prefixes = Arrays.asList(getContext().getResources().getStringArray(R.array.prefixes));
suffixes = Arrays.asList(getContext().getResources().getStringArray(R.array.suffixes));
titleDescriptions = Arrays.asList(getContext().getResources().getStringArray(R.array.title_descriptions));
titleLevels = Arrays.asList(getContext().getResources().getStringArray(R.array.title_levels));
titleJobs = Arrays.asList(getContext().getResources().getStringArray(R.array.title_jobs));
}
@Test
public void testFirstName() throws Exception {
for (int i = 0; i < 1000; i++) {
assertTrue(firstNames.contains(nameComponent.firstName()));
}
}
@Test
public void testLastName() throws Exception {
for (int i = 0; i < 1000; i++) {
assertTrue(lastNames.contains(nameComponent.lastName()));
}
}
@Test
public void testFullName() throws Exception {
for(int i = 0; i < 1000; i++) {
String [] fullName = nameComponent.fullName().split(" ");
String firstName = fullName[0];
String lastName = fullName[1];
assertTrue(firstNames.contains(firstName));
assertTrue(lastNames.contains(lastName));
}
}
@Test
public void testCompleteName() throws Exception {
for(int i = 0; i < 1000; i++) {
String [] fullName = nameComponent.completeName().split(" ");
String prefix = fullName[0];
String firstName = fullName[1];
String lastName = fullName[2];
String suffix = fullName[3];
assertTrue(prefixes.contains(prefix));
assertTrue(firstNames.contains(firstName));
assertTrue(lastNames.contains(lastName));
assertTrue(suffixes.contains(suffix));
}
}
@Test
public void testPrefix() throws Exception {
for (int i = 0 ; i < 1000; i++) {
assertTrue(prefixes.contains(nameComponent.prefix()));
}
}
@Test
public void testSuffix() throws Exception {
for (int i = 0 ; i < 1000; i++) {
assertTrue(suffixes.contains(nameComponent.suffix()));
}
}
@Test
public void testTitle() throws Exception {
for (int i = 0 ; i < 1000; i++) {
String [] fullTitle = nameComponent.title().split(" ");
String description = fullTitle[0];
String level = fullTitle[1];
String job = fullTitle[2];
assertTrue(titleDescriptions.contains(description));
assertTrue(titleLevels.contains(level));
assertTrue(titleJobs.contains(job));
}
}
@Test
public void testRandomText() throws Exception {
assertTrue(!TextUtils.isEmpty(nameComponent.randomText()));
}
}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/text/PhoneComponentTest.java
================================================
package io.kimo.lib.faker.component.text;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import org.junit.Before;
import org.junit.Test;
public class PhoneComponentTest extends AndroidTestCase {
private PhoneComponent phoneComponent;
@Before
public void setUp() throws Exception {
phoneComponent = new PhoneComponent(getContext());
}
@Test
public void testPhoneWithAreaCode() throws Exception {
String randomPhoneNumber = phoneComponent.phoneWithAreaCode();
assertTrue(randomPhoneNumber.contains("("));
assertTrue(randomPhoneNumber.contains(")"));
}
@Test
public void testPhoneWithCountryCode() throws Exception {
String randomPhoneNumber = phoneComponent.phoneWithCountryCode();
assertTrue(randomPhoneNumber.contains("-"));
}
@Test
public void testRandomText() throws Exception {
assertTrue(!TextUtils.isEmpty(phoneComponent.randomText()));
}
}
================================================
FILE: faker-core/src/androidTest/java/io/kimo/lib/faker/component/text/UrlComponentTest.java
================================================
package io.kimo.lib.faker.component.text;
import android.test.AndroidTestCase;
import org.junit.Before;
import org.junit.Test;
import io.kimo.lib.faker.component.number.NumberComponent;
public class UrlComponentTest extends AndroidTestCase {
private URLComponent url;
private NumberComponent numberComponent;
private String imageRegex = "http:\\/\\/lorempixel.com\\/\\d+\\/\\d+";
private String avatarRegex = "https:\\/\\/robohash.org\\/.+";
@Before
public void setUp() throws Exception {
url = new URLComponent(getContext());
numberComponent = new NumberComponent(getContext());
}
@Test
public void testImage() throws Exception {
String randomURL = url.image();
assertTrue(randomURL.matches(imageRegex));
}
@Test
public void testImageWithArguments() throws Exception {
int randomWidth = numberComponent.number(3);
int randomHeight = numberComponent.number(3);
String randomURL = url.image(randomWidth, randomHeight);
assertTrue(randomURL.contains(String.valueOf(randomHeight)));
assertTrue(randomURL.contains(String.valueOf(randomWidth)));
}
@Test
public void testAvatar() throws Exception {
String randomAvatarURL = url.avatar();
assertTrue(randomAvatarURL.matches(avatarRegex));
}
@Test
public void testAvatarWithArguments() throws Exception {
int randomWidth = numberComponent.number(3);
int randomHeight = numberComponent.number(3);
String randomURL = url.avatar(randomWidth, randomHeight);
assertTrue(randomURL.contains(String.valueOf(randomHeight)));
assertTrue(randomURL.contains(String.valueOf(randomWidth)));
}
}
================================================
FILE: faker-core/src/main/AndroidManifest.xml
================================================
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/Faker.java
================================================
package io.kimo.lib.faker;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.ToggleButton;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import io.kimo.lib.faker.component.FakerColorComponent;
import io.kimo.lib.faker.component.FakerNumericComponent;
import io.kimo.lib.faker.component.FakerTextComponent;
import io.kimo.lib.faker.component.number.ColorComponent;
import io.kimo.lib.faker.component.number.NumberComponent;
import io.kimo.lib.faker.component.text.AddressComponent;
import io.kimo.lib.faker.component.text.InternetComponent;
import io.kimo.lib.faker.component.text.LoremComponent;
import io.kimo.lib.faker.component.text.NameComponent;
import io.kimo.lib.faker.component.text.PhoneComponent;
import io.kimo.lib.faker.component.text.URLComponent;
public class Faker {
private static Faker mFaker;
public static LoremComponent Lorem;
public static NameComponent Name;
public static NumberComponent Number;
public static PhoneComponent Phone;
public static InternetComponent Internet;
public static URLComponent Url;
public static ColorComponent Color;
public static AddressComponent Address;
private HashSet mIds = null;
public static Faker with(Context context) {
if(mFaker == null) {
synchronized (Faker.class) {
if(mFaker == null) {
mFaker = new Faker(context);
}
}
}
return mFaker;
}
/**
* Configure all Faker components with a given context
* @param context
*/
private Faker(Context context) {
Lorem = new LoremComponent(context);
Name = new NameComponent(context);
Number = new NumberComponent(context);
Phone = new PhoneComponent(context);
Internet = new InternetComponent(context);
Url = new URLComponent(context);
Color = new ColorComponent(context);
Address = new AddressComponent(context);
}
/**
* Fill a view with random data
* @param view target view
*/
public void fill(View view) {
validateNotNullableView(view);
try {
if(view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for(int i = 0; i < viewGroup.getChildCount(); i++) {
View child = viewGroup.getChildAt(i);
fill(child);
}
} else {
if(mIds == null) {
fillView(view);
} else if(mIds.contains(view.getId())) {
fillView(view);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
mFaker = null;
}
}
/**
* Fill a TextView with a specific FakerTextComponent
* @param view
* @param component
*/
public void fillWithText(TextView view, FakerTextComponent component) {
validateNotNullableView(view);
validateIfIsATextView(view);
validateNotNullableFakerComponent(component);
view.setText(component.randomText());
}
/**
* Specify with views are going to be filled with data.
* @param ids - collection of ids
*/
public Faker targetViews(Integer...ids) {
mIds = new HashSet<>(Arrays.asList(ids));
return this;
}
/**
* Fill a TextView with a specific FakerNumericComponent
* @param view
* @param component
*/
public void fillWithNumber(TextView view, FakerNumericComponent component) {
validateNotNullableView(view);
validateIfIsATextView(view);
validateNotNullableFakerComponent(component);
view.setText(String.valueOf(component.randomNumber()));
}
/**
* Fill view with a random color
* @param view
* @param component
*/
public void fillWithColor(View view, FakerColorComponent component) {
validateNotNullableView(view);
validateNotNullableFakerComponent(component);
view.setBackgroundColor(component.randomColor());
}
/**
* Set a random check or uncheck state
* @param view
*/
public void fillWithCheckState(CompoundButton view) {
validateNotNullableView(view);
validateIfIsACompoundButton(view);
view.setChecked(new Random().nextBoolean());
}
/**
* Fill {@link ToggleButton} on and off text
* @param view
* @param component
*/
public void fillOnAndOffWithText(ToggleButton view, FakerTextComponent component) {
validateNotNullableView(view);
validateIfIsAToggleButton(view);
validateNotNullableFakerComponent(component);
String word = component.randomText();
view.setTextOff(word);
view.setTextOn(word);
}
/**
* Fill a @{link ProgressBar} with a random progress
* @param view
* @param component
*/
public void fillWithProgress(ProgressBar view, FakerNumericComponent component) {
validateNotNullableView(view);
validateIfIsAProgressBar(view);
validateNotNullableFakerComponent(component);
view.setProgress(Math.abs(component.randomNumber().intValue()));
}
private void fillView(View view) {
if(view instanceof TextView) {
if(view instanceof ToggleButton) {
fillOnAndOffWithText((ToggleButton) view, Lorem);
} else {
fillWithText((TextView) view, Lorem);
}
}
if(view instanceof CompoundButton) {
fillWithCheckState((CompoundButton) view);
}
if(view instanceof ImageView) {
fillWithColor(view, Color);
}
if(view instanceof ProgressBar) {
fillWithProgress((ProgressBar) view, Number);
}
}
private void validateIfIsACompoundButton(View view) {
if(!(view instanceof CompoundButton))
throw new IllegalArgumentException("View must be a CompoundButton");
}
private void validateIfIsATextView(View view) {
if(!(view instanceof TextView))
throw new IllegalArgumentException("View must be a TextView");
}
private void validateNotNullableView(View view) {
if(view == null) {
throw new IllegalArgumentException("View must not be null");
}
}
private void validateNotNullableFakerComponent(FakerCoreComponent component) {
if(component == null) {
throw new IllegalArgumentException("FakerComponent must not be null");
}
}
private void validateIfIsAToggleButton(View view) {
if(!(view instanceof ToggleButton)) {
throw new IllegalArgumentException("View must be a ToggleButton");
}
}
private void validateIfIsAProgressBar(View view) {
if(!(view instanceof ProgressBar)) {
throw new IllegalArgumentException("View must be a ProgressBar");
}
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/FakerCoreComponent.java
================================================
package io.kimo.lib.faker;
import android.content.Context;
public abstract class FakerCoreComponent {
protected Context context;
public FakerCoreComponent(Context context) {
if(context == null) {
throw new IllegalArgumentException("Context must not be null.");
}
this.context = context;
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/AddressAPI.java
================================================
package io.kimo.lib.faker.api;
public interface AddressAPI {
String city();
String street();
String streetWithNumber();
String secondaryAddress();
String buildingNumber();
String zipCode();
String postCode();
String timeZone();
String citySuffix();
String cityPrefix();
String state();
String stateAbbreviation();
String country();
String countryAbbreviation();
String latitude();
String longitude();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/ColorAPI.java
================================================
package io.kimo.lib.faker.api;
public interface ColorAPI {
int redColor();
int [] redColors(int numberOfRedColors);
int greenColor();
int [] greenColors(int numberOfGreenColors);
int blueColor();
int [] blueColors(int numberOfBlueColors);
int monochromeColor();
int brightColor();
int lightColor();
int darkColor();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/InternetAPI.java
================================================
package io.kimo.lib.faker.api;
public interface InternetAPI {
String email();
String email(String name, String domain, String suffix);
String domain();
String domainSuffix();
String domainSuffix(String suffix);
String url();
String url(String domain, String suffix);
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/LoremAPI.java
================================================
package io.kimo.lib.faker.api;
public interface LoremAPI {
String character();
String characters();
String characters(int numberOfCharacters);
String word();
String words();
String words(int numberOfWords);
String sentence();
String sentences();
String sentences(int numberOfSentences);
String paragraph();
String paragraphs();
String paragraphs(int numberOfParagraphs);
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/NameAPI.java
================================================
package io.kimo.lib.faker.api;
public interface NameAPI {
String firstName();
String lastName();
String fullName();
String completeName();
String prefix();
String suffix();
String title();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/NumberAPI.java
================================================
package io.kimo.lib.faker.api;
import java.util.Random;
public interface NumberAPI {
void setSeed(Random random);
int digit();
int positiveDigit();
int negativeDigit();
int number();
int number(int amountOfDigits);
int positiveNumber();
int negativeNumber();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/PhoneAPI.java
================================================
package io.kimo.lib.faker.api;
public interface PhoneAPI {
String phoneWithAreaCode();
String phoneWithCountryCode();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/api/UrlAPI.java
================================================
package io.kimo.lib.faker.api;
public interface UrlAPI {
String image();
String image(int width, int height);
String avatar();
String avatar(int width, int height);
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/FakerColorComponent.java
================================================
package io.kimo.lib.faker.component;
import android.content.Context;
public abstract class FakerColorComponent extends FakerNumericComponent {
public FakerColorComponent(Context context) {
super(context);
}
public abstract int randomColor();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/FakerNumericComponent.java
================================================
package io.kimo.lib.faker.component;
import android.content.Context;
import io.kimo.lib.faker.FakerCoreComponent;
public abstract class FakerNumericComponent extends FakerCoreComponent {
public FakerNumericComponent(Context context) {
super(context);
}
public abstract Number randomNumber();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/FakerTextComponent.java
================================================
package io.kimo.lib.faker.component;
import android.content.Context;
import io.kimo.lib.faker.FakerCoreComponent;
public abstract class FakerTextComponent extends FakerCoreComponent {
public FakerTextComponent(Context context) {
super(context);
}
public abstract String randomText();
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/number/ColorComponent.java
================================================
package io.kimo.lib.faker.component.number;
import android.content.Context;
import com.github.lzyzsd.randomcolor.RandomColor;
import io.kimo.lib.faker.api.ColorAPI;
import io.kimo.lib.faker.component.FakerColorComponent;
/**
* Provides random colors based on AndroidRandomColor by lzyzsd (https://github.com/lzyzsd/AndroidRandomColor)
*/
public class ColorComponent extends FakerColorComponent implements ColorAPI {
public ColorComponent(Context context) {
super(context);
}
@Override
public Number randomNumber() {
return randomColor();
}
@Override
public int randomColor() {
return new RandomColor().randomColor();
}
@Override
public int redColor() {
return new RandomColor().randomColor(RandomColor.Color.RED);
}
@Override
public int[] redColors(int numberOfRedColors) {
return new RandomColor().random(RandomColor.Color.RED, numberOfRedColors);
}
@Override
public int greenColor() {
return new RandomColor().randomColor(RandomColor.Color.GREEN);
}
@Override
public int[] greenColors(int numberOfGreenColors) {
return new RandomColor().random(RandomColor.Color.GREEN, numberOfGreenColors);
}
@Override
public int blueColor() {
return new RandomColor().randomColor(RandomColor.Color.BLUE);
}
@Override
public int[] blueColors(int numberOfBlueColors) {
return new RandomColor().random(RandomColor.Color.BLUE, numberOfBlueColors);
}
@Override
public int monochromeColor() {
return new RandomColor().randomColor(randomColor(), RandomColor.SaturationType.MONOCHROME, RandomColor.Luminosity.RANDOM);
}
@Override
public int brightColor() {
return new RandomColor().randomColor(randomColor(), RandomColor.SaturationType.RANDOM, RandomColor.Luminosity.BRIGHT);
}
@Override
public int lightColor() {
return new RandomColor().randomColor(randomColor(), RandomColor.SaturationType.RANDOM, RandomColor.Luminosity.LIGHT);
}
@Override
public int darkColor() {
return new RandomColor().randomColor(randomColor(), RandomColor.SaturationType.RANDOM, RandomColor.Luminosity.DARK);
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/number/NumberComponent.java
================================================
package io.kimo.lib.faker.component.number;
import android.content.Context;
import java.util.Random;
import io.kimo.lib.faker.api.NumberAPI;
import io.kimo.lib.faker.component.FakerNumericComponent;
public class NumberComponent extends FakerNumericComponent implements NumberAPI {
private Random mRandom = new Random();
public NumberComponent(Context context) {
super(context);
}
@Override
public Number randomNumber() {
int method = (int)(Math.random() * 10);
switch (method % 6) {
case 0:
return digit();
case 1:
return positiveDigit();
case 2:
return negativeDigit();
case 3:
return number();
case 4:
return positiveNumber();
case 5:
return negativeNumber();
default:
return 0;
}
}
private int randomNumberInRangePositiveOrNegative(int min, int max) {
return mRandom.nextInt((max - min) + 1) + min;
}
@Override
public void setSeed(Random random) {
mRandom = random;
}
public Random getSeed() {
return mRandom;
}
@Override
public int digit() {
return randomNumberInRangePositiveOrNegative(-9, 9);
}
@Override
public int positiveDigit() {
return randomNumberInRangePositiveOrNegative(0, 9);
}
@Override
public int negativeDigit() {
return randomNumberInRangePositiveOrNegative(-9,-1);
}
@Override
public int number() {
int randomSignal = (int) (Math.random() * 10);
if(randomSignal % 2 == 0) {
return number(randomNumberInRangePositiveOrNegative(1, 9));
} else {
return -number(randomNumberInRangePositiveOrNegative(1, 9));
}
}
@Override
public int number(int amountOfDigits) {
if(amountOfDigits < 1) {
throw new IllegalArgumentException("Argument must be bigger than 0");
}
StringBuilder randomNumbers = new StringBuilder();
for(int i = 0; i < amountOfDigits; i++) {
randomNumbers.append(randomNumberInRangePositiveOrNegative(1,9));
}
return Math.abs(Integer.parseInt(randomNumbers.toString()));
}
@Override
public int positiveNumber() {
return Math.abs(number());
}
@Override
public int negativeNumber() {
return -positiveNumber();
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/text/AddressComponent.java
================================================
package io.kimo.lib.faker.component.text;
import android.content.Context;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.api.AddressAPI;
import io.kimo.lib.faker.component.FakerTextComponent;
import io.kimo.lib.faker.component.number.NumberComponent;
public class AddressComponent extends FakerTextComponent implements AddressAPI {
private NameComponent nameComponent;
private NumberComponent numberComponent;
private List cityPrefixes, citySuffixes, streetSuffixes, secondaryAddressPrefixes, zipCodeMasks, timezones, states, statesAbbrv, countries, countriesAbbrv;
public AddressComponent(Context context) {
super(context);
nameComponent = new NameComponent(context);
numberComponent = new NumberComponent(context);
cityPrefixes = Arrays.asList(context.getResources().getStringArray(R.array.city_prefixes));
citySuffixes = Arrays.asList(context.getResources().getStringArray(R.array.city_suffixes));
streetSuffixes = Arrays.asList(context.getResources().getStringArray(R.array.street_suffixes));
secondaryAddressPrefixes = Arrays.asList(context.getResources().getStringArray(R.array.secondary_address_prefixes));
zipCodeMasks = Arrays.asList(context.getResources().getStringArray(R.array.zipcode_masks));
timezones = Arrays.asList(context.getResources().getStringArray(R.array.timezone));
states = Arrays.asList(context.getResources().getStringArray(R.array.states));
statesAbbrv = Arrays.asList(context.getResources().getStringArray(R.array.states_abbrv));
countries = Arrays.asList(context.getResources().getStringArray(R.array.countries));
countriesAbbrv = Arrays.asList(context.getResources().getStringArray(R.array.countries_abbrv));
}
private String numbersInMask(String mask, char maskPlaceholder) {
StringBuilder phoneInMask = new StringBuilder();
for(int i = 0; i < mask.length(); i++) {
char currentChar = mask.charAt(i);
if(currentChar == maskPlaceholder) {
phoneInMask.append(numberComponent.positiveDigit());
} else {
phoneInMask.append(currentChar);
}
}
return phoneInMask.toString();
}
@Override
public String city() {
Random random = new Random();
StringBuilder cityName = new StringBuilder();
boolean withFirstName = random.nextBoolean();
boolean withPrefix = random.nextBoolean();
boolean withSuffix;
if(withPrefix) {
withSuffix = random.nextBoolean();
} else {
withSuffix = true;
}
if(withPrefix) {
cityName.append(cityPrefix());
}
cityName.append(" ");
if(withFirstName) {
cityName.append(nameComponent.firstName());
} else {
cityName.append(nameComponent.lastName());
}
if(withSuffix) {
cityName.append(" ");
cityName.append(citySuffix());
}
return cityName.toString();
}
@Override
public String street() {
boolean firstName = new Random().nextBoolean();
if(firstName) {
return nameComponent.firstName() + " " + streetSuffixes.get(new Random().nextInt(streetSuffixes.size()));
} else {
return nameComponent.lastName() + " " + streetSuffixes.get(new Random().nextInt(streetSuffixes.size()));
}
}
@Override
public String streetWithNumber() {
return buildingNumber() + " " + street();
}
@Override
public String secondaryAddress() {
return secondaryAddressPrefixes.get(new Random().nextInt(secondaryAddressPrefixes.size())) + " " + buildingNumber();
}
@Override
public String buildingNumber() {
return numberComponent.positiveNumber()+"";
}
@Override
public String zipCode() {
String mask = zipCodeMasks.get(new Random().nextInt(zipCodeMasks.size()));
return numbersInMask(mask, '#');
}
@Override
public String postCode() {
return zipCode();
}
@Override
public String timeZone() {
return timezones.get(new Random().nextInt(timezones.size()));
}
@Override
public String citySuffix() {
return citySuffixes.get(new Random().nextInt(citySuffixes.size()));
}
@Override
public String cityPrefix() {
return cityPrefixes.get(new Random().nextInt(cityPrefixes.size()));
}
@Override
public String state() {
return states.get(new Random().nextInt(states.size()));
}
@Override
public String stateAbbreviation() {
return statesAbbrv.get(new Random().nextInt(statesAbbrv.size()));
}
@Override
public String country() {
return countries.get(new Random().nextInt(countries.size()));
}
@Override
public String countryAbbreviation() {
return countriesAbbrv.get(new Random().nextInt(countriesAbbrv.size()));
}
@Override
public String latitude() {
return String.valueOf((Math.random() * 180) - 90);
}
@Override
public String longitude() {
return String.valueOf((Math.random() * 360) - 90);
}
@Override
public String randomText() {
int method = (int) Math.random() * 10;
switch (method % 15) {
case 0:
return city();
case 1:
return street();
case 2:
return streetWithNumber();
case 3:
return secondaryAddress();
case 4:
return buildingNumber();
case 5:
return zipCode();
case 6:
return postCode();
case 7:
return citySuffix();
case 8:
return cityPrefix();
case 9:
return state();
case 10:
return stateAbbreviation();
case 11:
return country();
case 12:
return countryAbbreviation();
case 13:
return latitude();
case 14:
return longitude();
default:
return "";
}
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/text/InternetComponent.java
================================================
package io.kimo.lib.faker.component.text;
import android.content.Context;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.api.InternetAPI;
import io.kimo.lib.faker.component.FakerTextComponent;
public class InternetComponent extends FakerTextComponent implements InternetAPI {
private NameComponent nameComponent;
private List domainSuffix;
public InternetComponent(Context context) {
super(context);
nameComponent = new NameComponent(context);
domainSuffix = Arrays.asList(context.getResources().getStringArray(R.array.domain_suffixes));
}
@Override
public String randomText() {
int method = (int)(Math.random() * 10);
switch (method % 4) {
case 0:
return email();
case 1:
return domain();
case 2:
return domainSuffix();
case 3:
return url();
default:
return "";
}
}
@Override
public String email() {
return email(nameComponent.firstName(), domain(), domainSuffix());
}
@Override
public String email(String name, String domain, String suffix) {
return (name + "@" + domain + suffix).toLowerCase();
}
@Override
public String domain() {
return nameComponent.lastName().toLowerCase();
}
@Override
public String domainSuffix() {
return domainSuffix(domainSuffix.get(new Random().nextInt(domainSuffix.size())));
}
@Override
public String domainSuffix(String suffix) {
return "."+suffix;
}
@Override
public String url() {
return url(nameComponent.lastName(), domainSuffix());
}
@Override
public String url(String domain, String suffix) {
return ("http://" + domain + suffix).toLowerCase();
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/text/LoremComponent.java
================================================
package io.kimo.lib.faker.component.text;
import android.content.Context;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.api.LoremAPI;
import io.kimo.lib.faker.component.FakerTextComponent;
public class LoremComponent extends FakerTextComponent implements LoremAPI {
public static final int [] DEFAULT_RANDOM_NUMBERS_POOL = {3,4,5,6,7};
public static final int DEFAULT_NUMBER_OF_CHARACTERS = 255;
public static final String ALPHA_NUMERIC_CHARACTERS = "0123456789abcdefghijklmnopqrstuwvxyz";
public static final String INVALID_ARGUMENT_ERROR_MSG = "Argument should be bigger than 0";
private List loremWords;
public LoremComponent(Context context) {
super(context);
loremWords = Arrays.asList(context.getResources().getStringArray(R.array.lorem_words));
}
@Override
public String randomText() {
int method = (int)(Math.random() * 10);
switch (method % 4) {
case 0:
return characters();
case 1:
return words();
case 2:
return sentences();
case 3:
return paragraphs();
default:
return "";
}
}
/**
* Provides a random words from the words list
* @return a String with the word
*/
@Override
public String word() {
return loremWords.get(new Random().nextInt(loremWords.size()));
}
/**
* Provies random words from the words list.
* The amount of words varies from 3 to 7.
* @return a String with the words
*/
@Override
public String words() {
int numberOfWords = DEFAULT_RANDOM_NUMBERS_POOL[new Random().nextInt(DEFAULT_RANDOM_NUMBERS_POOL.length)];
return words(numberOfWords);
}
/**
* Provides the
* @param numberOfWords
* @return a String with the words
*/
@Override
public String words(int numberOfWords) {
if (numberOfWords < 1) {
throw new IllegalArgumentException(INVALID_ARGUMENT_ERROR_MSG);
}
List loremWords = new ArrayList<>();
for(int i = 0; i < numberOfWords; i++) {
loremWords.add(word());
}
return TextUtils.join(" ", loremWords);
}
@Override
public String sentence() {
String randomWords = words();
return randomWords.substring(0,1).toUpperCase() + randomWords.substring(1) + ".";
}
@Override
public String sentences() {
int randomNumberOfSentences = DEFAULT_RANDOM_NUMBERS_POOL[new Random().nextInt(DEFAULT_RANDOM_NUMBERS_POOL.length)];
return sentences(randomNumberOfSentences);
}
@Override
public String sentences(int numberOfSentences) {
if (numberOfSentences < 1) {
throw new IllegalArgumentException(INVALID_ARGUMENT_ERROR_MSG);
}
List sentences = new ArrayList<>();
for(int i = 0; i < numberOfSentences; i++) {
sentences.add(sentence());
}
return TextUtils.join(" ", sentences);
}
@Override
public String character() {
return characters(1);
}
@Override
public String characters() {
return characters(DEFAULT_NUMBER_OF_CHARACTERS);
}
@Override
public String characters(int numberOfCharacters) {
if(numberOfCharacters < 1) {
throw new IllegalArgumentException(INVALID_ARGUMENT_ERROR_MSG);
}
StringBuilder randomCharacters = new StringBuilder();
for(int i = 0; i < numberOfCharacters; i++) {
randomCharacters.append(ALPHA_NUMERIC_CHARACTERS.charAt(new Random().nextInt(ALPHA_NUMERIC_CHARACTERS.length())));
}
return randomCharacters.toString();
}
@Override
public String paragraph() {
return paragraphs(1);
}
@Override
public String paragraphs() {
int randomNumberOfParagraphs = DEFAULT_RANDOM_NUMBERS_POOL[new Random().nextInt(DEFAULT_RANDOM_NUMBERS_POOL.length)];
return paragraphs(randomNumberOfParagraphs);
}
@Override
public String paragraphs(int numberOfParagraphs) {
if(numberOfParagraphs < 1) {
throw new IllegalArgumentException(INVALID_ARGUMENT_ERROR_MSG);
}
StringBuilder paragraphs = new StringBuilder();
for(int i = 0; i < numberOfParagraphs; i++) {
paragraphs.append(sentences());
if(i != numberOfParagraphs-1) {
paragraphs.append("\n");
}
}
return paragraphs.toString();
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/text/NameComponent.java
================================================
package io.kimo.lib.faker.component.text;
import android.content.Context;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.api.NameAPI;
import io.kimo.lib.faker.component.FakerTextComponent;
public class NameComponent extends FakerTextComponent implements NameAPI {
private List firstNames, lastNames, prefixes, suffixes, titleDescriptons, titleLevels, titleJobs;
public NameComponent(Context context) {
super(context);
firstNames = Arrays.asList(context.getResources().getStringArray(R.array.first_names));
lastNames = Arrays.asList(context.getResources().getStringArray(R.array.last_names));
prefixes = Arrays.asList(context.getResources().getStringArray(R.array.prefixes));
suffixes = Arrays.asList(context.getResources().getStringArray(R.array.suffixes));
titleDescriptons = Arrays.asList(context.getResources().getStringArray(R.array.title_descriptions));
titleLevels = Arrays.asList(context.getResources().getStringArray(R.array.title_levels));
titleJobs = Arrays.asList(context.getResources().getStringArray(R.array.title_jobs));
}
@Override
public String randomText() {
int method = (int)(Math.random() * 10);
switch (method % 7) {
case 0:
return firstName();
case 1:
return lastName();
case 2:
return fullName();
case 3:
return completeName();
case 4:
return prefix();
case 5:
return suffix();
case 6:
return title();
default:
return "";
}
}
@Override
public String firstName() {
return firstNames.get(new Random().nextInt(firstNames.size()));
}
@Override
public String lastName() {
return lastNames.get(new Random().nextInt(lastNames.size()));
}
@Override
public String fullName() {
return firstName() + " " + lastName();
}
@Override
public String completeName() {
return prefix() + " " + firstName() + " " + lastName() + " " + suffix();
}
@Override
public String prefix() {
return prefixes.get(new Random().nextInt(prefixes.size()));
}
@Override
public String suffix() {
return suffixes.get(new Random().nextInt(suffixes.size()));
}
@Override
public String title() {
return titleDescriptons.get(new Random().nextInt(titleDescriptons.size())) +
" " +
titleLevels.get(new Random().nextInt(titleLevels.size())) +
" " +
titleJobs.get(new Random().nextInt(titleJobs.size()));
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/text/PhoneComponent.java
================================================
package io.kimo.lib.faker.component.text;
import android.content.Context;
import java.lang.*;
import io.kimo.lib.faker.R;
import io.kimo.lib.faker.api.PhoneAPI;
import io.kimo.lib.faker.component.FakerTextComponent;
import io.kimo.lib.faker.component.number.NumberComponent;
public class PhoneComponent extends FakerTextComponent implements PhoneAPI {
private String areaCodeMask, countryCodeMask;
private NumberComponent numberComponent;
public PhoneComponent(Context context) {
super(context);
numberComponent = new NumberComponent(context);
areaCodeMask = context.getResources().getString(R.string.area_code_phone_mask);
countryCodeMask = context.getResources().getString(R.string.country_code_phone_mask);
}
@Override
public String randomText() {
int method = (int)(Math.random() * 10);
switch (method % 2) {
case 0:
return phoneWithAreaCode();
case 1:
return phoneWithCountryCode();
default:
return "";
}
}
private String numbersInMask(String mask, char maskPlaceholder) {
StringBuilder phoneInMask = new StringBuilder();
for(int i = 0; i < mask.length(); i++) {
char currentChar = mask.charAt(i);
if(currentChar == maskPlaceholder) {
phoneInMask.append(numberComponent.positiveDigit());
} else {
phoneInMask.append(currentChar);
}
}
return phoneInMask.toString();
}
@Override
public String phoneWithAreaCode() {
return numbersInMask(areaCodeMask, '#');
}
@Override
public String phoneWithCountryCode() {
return numbersInMask(countryCodeMask, '#');
}
}
================================================
FILE: faker-core/src/main/java/io/kimo/lib/faker/component/text/URLComponent.java
================================================
package io.kimo.lib.faker.component.text;
import android.content.Context;
import io.kimo.lib.faker.api.UrlAPI;
import io.kimo.lib.faker.component.FakerTextComponent;
public class URLComponent extends FakerTextComponent implements UrlAPI {
private static final String BASE_IMAGE_URL = "http://lorempixel.com/";
private static final String BASE_AVATAR_URL = "https://robohash.org/";
private static final int DEFAULT_DIMENSION = 300;
private NameComponent nameComponent;
public URLComponent(Context context) {
super(context);
nameComponent = new NameComponent(context);
}
@Override
public String randomText() {
int method = (int)(Math.random() * 10);
switch (method % 2) {
case 0:
return image();
case 1:
return avatar();
default:
return "";
}
}
@Override
public String image() {
return image(DEFAULT_DIMENSION,DEFAULT_DIMENSION);
}
@Override
public String image(int width, int height) {
return BASE_IMAGE_URL + width + "/" + height;
}
@Override
public String avatar() {
return avatar(DEFAULT_DIMENSION,DEFAULT_DIMENSION);
}
@Override
public String avatar(int width, int height) {
return BASE_AVATAR_URL + nameComponent.firstName() + "?size=" + width + "x" + height;
}
}
================================================
FILE: faker-core/src/main/res/values/address.xml
================================================
NorthEastWestSouthNewLakePorttowntonlandvillebergburghboroughburyviewportmouthstadfurtchesterforthavensideshireAlleyAvenueBranchBridgeBrookBrooksBurgBurgsBypassCampCanyonCapeCausewayCenterCentersCircleCirclesCliffCliffsClubCommonCornerCornersCourseCourtCourtsCoveCovesCreekCrescentCrestCrossingCrossroadCurveDaleDamDivideDriveDriveDrivesEstateEstatesExpresswayExtensionExtensionsFallFallsFerryFieldFieldsFlatFlatsFordFordsForestForgeForgesForkForksFortFreewayGardenGardensGatewayGlenGlensGreenGreensGroveGrovesHarborHarborsHavenHeightsHighwayHillHillsHollowInletInletIslandIslandIslandsIslandsIsleIsleJunctionJunctionsKeyKeysKnollKnollsLakeLakesLandLandingLaneLightLightsLoafLockLocksLocksLodgeLodgeLoopMallManorManorsMeadowMeadowsMewsMillMillsMissionMissionMotorwayMountMountainMountainMountainsMountainsNeckOrchardOvalOverpassParkParksParkwayParkwaysPassPassagePathPikePinePinesPlacePlainPlainsPlainsPlazaPlazaPointPointsPortPortPortsPortsPrairiePrairieRadialRampRanchRapidRapidsRestRidgeRidgesRiverRoadRoadRoadsRoadsRouteRowRueRunShoalShoalsShoreShoresSkywaySpringSpringsSpringsSpurSpursSquareSquareSquaresSquaresStationStationStravenueStravenueStreamStreamStreetStreetStreetsSummitSummitTerraceThroughwayTraceTrackTrafficwayTrailTrailTunnelTunnelTurnpikeTurnpikeUnderpassUnionUnionsValleyValleysViaViaductViewViewsVillageVillageVillagesVilleVistaVistaWalkWalksWallWayWaysWellWellApt.SuiteBlock##########-####Pacific/MidwayPacific/Pago_PagoPacific/HonoluluAmerica/JuneauAmerica/Los_AngelesAmerica/TijuanaAmerica/DenverAmerica/PhoenixAmerica/ChihuahuaAmerica/MazatlanAmerica/ChicagoAmerica/ReginaAmerica/Mexico_CityAmerica/Mexico_CityAmerica/MonterreyAmerica/GuatemalaAmerica/New_YorkAmerica/Indiana/IndianapolisAmerica/BogotaAmerica/LimaAmerica/LimaAmerica/HalifaxAmerica/CaracasAmerica/La_PazAmerica/SantiagoAmerica/St_JohnsAmerica/Sao_PauloAmerica/Argentina/Buenos_AiresAmerica/GuyanaAmerica/GodthabAtlantic/South_GeorgiaAtlantic/AzoresAtlantic/Cape_VerdeEurope/DublinEurope/LondonEurope/LisbonEurope/LondonAfrica/CasablancaAfrica/MonroviaEtc/UTCEurope/BelgradeEurope/BratislavaEurope/BudapestEurope/LjubljanaEurope/PragueEurope/SarajevoEurope/SkopjeEurope/WarsawEurope/ZagrebEurope/BrusselsEurope/CopenhagenEurope/MadridEurope/ParisEurope/AmsterdamEurope/BerlinEurope/BerlinEurope/RomeEurope/StockholmEurope/ViennaAfrica/AlgiersEurope/BucharestAfrica/CairoEurope/HelsinkiEurope/KievEurope/RigaEurope/SofiaEurope/TallinnEurope/VilniusEurope/AthensEurope/IstanbulEurope/MinskAsia/JerusalemAfrica/HarareAfrica/JohannesburgEurope/MoscowEurope/MoscowEurope/MoscowAsia/KuwaitAsia/RiyadhAfrica/NairobiAsia/BaghdadAsia/TehranAsia/MuscatAsia/MuscatAsia/BakuAsia/TbilisiAsia/YerevanAsia/KabulAsia/YekaterinburgAsia/KarachiAsia/KarachiAsia/TashkentAsia/KolkataAsia/KolkataAsia/KolkataAsia/KolkataAsia/KathmanduAsia/DhakaAsia/DhakaAsia/ColomboAsia/AlmatyAsia/NovosibirskAsia/RangoonAsia/BangkokAsia/BangkokAsia/JakartaAsia/KrasnoyarskAsia/ShanghaiAsia/ChongqingAsia/Hong_KongAsia/UrumqiAsia/Kuala_LumpurAsia/SingaporeAsia/TaipeiAustralia/PerthAsia/IrkutskAsia/UlaanbaatarAsia/SeoulAsia/TokyoAsia/TokyoAsia/TokyoAsia/YakutskAustralia/DarwinAustralia/AdelaideAustralia/MelbourneAustralia/MelbourneAustralia/SydneyAustralia/BrisbaneAustralia/HobartAsia/VladivostokPacific/GuamPacific/Port_MoresbyAsia/MagadanAsia/MagadanPacific/NoumeaPacific/FijiAsia/KamchatkaPacific/MajuroPacific/AucklandPacific/AucklandPacific/TongatapuPacific/FakaofoPacific/ApiaAlabamaAlaskaArizonaArkansasCaliforniaColoradoConnecticutDelawareFloridaGeorgiaHawaiiIdahoIllinoisIndianaIowaKansasKentuckyLouisianaMaineMarylandMassachusettsMichiganMinnesotaMississippiMissouriMontanaNebraskaNevadaNew HampshireNew JerseyNew MexicoNew YorkNorth CarolinaNorth DakotaOhioOklahomaOregonPennsylvaniaRhode IslandSouth CarolinaSouth DakotaTennesseeTexasUtahVermontVirginiaWashingtonWest VirginiaWisconsinWyomingALAKAZARCACOCTDEFLGAHIIDILINIAKSKYLAMEMDMAMIMNMSMOMTNENVNHNJNMNYNCNDOHOKORPARISCSDTNTXUTVTVAWAWVWIWYAfghanistanAlbaniaAlgeriaAmerican SamoaAndorraAngolaAnguillaAntarctica (the territory South of 60 deg S)Antigua and BarbudaArgentinaArmeniaArubaAustraliaAustriaAzerbaijanBahamasBahrainBangladeshBarbadosBelarusBelgiumBelizeBeninBermudaBhutanBoliviaBosnia and HerzegovinaBotswanaBouvet Island (Bouvetoya)BrazilBritish Indian Ocean Territory (Chagos Archipelago)Brunei DarussalamBulgariaBurkina FasoBurundiCambodiaCameroonCanadaCape VerdeCayman IslandsCentral African RepublicChadChileChinaChristmas IslandCocos (Keeling) IslandsColombiaComorosCongoCongoCook IslandsCosta RicaCote d\'IvoireCroatiaCubaCyprusCzech RepublicDenmarkDjiboutiDominicaDominican RepublicEcuadorEgyptEl SalvadorEquatorial GuineaEritreaEstoniaEthiopiaFaroe IslandsFalkland Islands (Malvinas)FijiFinlandFranceFrench GuianaFrench PolynesiaFrench Southern TerritoriesGabonGambiaGeorgiaGermanyGhanaGibraltarGreeceGreenlandGrenadaGuadeloupeGuamGuatemalaGuernseyGuineaGuinea-BissauGuyanaHaitiHeard Island and McDonald IslandsHoly See (Vatican City State)HondurasHong KongHungaryIcelandIndiaIndonesiaIranIraqIrelandIsle of ManIsraelItalyJamaicaJapanJerseyJordanKazakhstanKenyaKiribatiDemocratic People\'s Republic of KoreaRepublic of KoreaKuwaitKyrgyz RepublicLao People\'s Democratic RepublicLatviaLebanonLesothoLiberiaLibyan Arab JamahiriyaLiechtensteinLithuaniaLuxembourgMacaoMacedoniaMadagascarMalawiMalaysiaMaldivesMaliMaltaMarshall IslandsMartiniqueMauritaniaMauritiusMayotteMexicoMicronesiaMoldovaMonacoMongoliaMontenegroMontserratMoroccoMozambiqueMyanmarNamibiaNauruNepalNetherlands AntillesNetherlandsNew CaledoniaNew ZealandNicaraguaNigerNigeriaNiueNorfolk IslandNorthern Mariana IslandsNorwayOmanPakistanPalauPalestinian TerritoryPanamaPapua New GuineaParaguayPeruPhilippinesPitcairn IslandsPolandPortugalPuerto RicoQatarReunionRomaniaRussian FederationRwandaSaint BarthelemySaint HelenaSaint Kitts and NevisSaint LuciaSaint MartinSaint Pierre and MiquelonSaint Vincent and the GrenadinesSamoaSan MarinoSao Tome and PrincipeSaudi ArabiaSenegalSerbiaSeychellesSierra LeoneSingaporeSlovakia (Slovak Republic)SloveniaSolomon IslandsSomaliaSouth AfricaSouth Georgia and the South Sandwich IslandsSpainSri LankaSudanSurinameSvalbard & Jan Mayen IslandsSwazilandSwedenSwitzerlandSyrian Arab RepublicTaiwanTajikistanTanzaniaThailandTimor-LesteTogoTokelauTongaTrinidad and TobagoTunisiaTurkeyTurkmenistanTurks and Caicos IslandsTuvaluUgandaUkraineUnited Arab EmiratesUnited KingdomUnited States of AmericaUnited States Minor Outlying IslandsUruguayUzbekistanVanuatuVenezuelaVietnamVirgin IslandsBritishU.S.Wallis and FutunaWestern SaharaYemenZambiaZimbabweADAEAFAGAIALAMAOAQARASATAUAWAXAZBABBBDBEBFBGBHBIBJBLBMBNBOBQBQBRBSBTBVBWBYBZCACCCDCFCGCHCICKCLCMCNCOCRCUCVCWCXCYCZDEDJDKDMDODZECEEEGEHERESETFIFJFKFMFOFRGAGBGDGEGFGGGHGIGLGMGNGPGQGRGSGTGUGWGYHKHMHNHRHTHUIDIEILIMINIOIQIRISITJEJMJOJPKEKGKHKIKMKNKPKRKWKYKZLALBLCLILKLRLSLTLULVLYMAMCMDMEMFMGMHMKMLMMMNMOMPMQMRMSMTMUMVMWMXMYMZNANCNENFNGNINLNONPNRNUNZOMPAPEPFPGPHPKPLPMPNPRPSPTPWPYQARERORSRURWSASBSCSDSESGSHSISJSKSLSMSNSOSRSSSTSVSXSYSZTCTDTFTGTHTJTKTLTMTNTOTRTTTVTWTZUAUGUMUSUYUZVAVCVEVGVIVNVUWFWSYEYTZAZMZW
================================================
FILE: faker-core/src/main/res/values/internet.xml
================================================
acacukadaeaeroafagaialamanaoaqararpaasasiaatauawaxazbabbbdbebfbgbhbibizbjbmbnbobrbsbtbvbwbybzcacatcccdcfcgchcickclcmcncocoukcomcoopcrcscucvcxcyczdddedjdkdmdodzecedueeegehereseteufifirmfjfkfmfofrfxgagbgdgegfghgiglgmgngovgovukgpgqgrgsgtgugwgyhkhmhnhrhthuidieilimininfointioiqirisitjejmjojobsjpkekgkhkikmknkpkrkwkykzlalblclilklrlsltltduklulvlymamcmdmemeukmgmhmilmkmlmmmnmomobimodukmpmqmrmsmtmumuseummvmwmxmymznanamenatoncnenetnetuknfngnhsukninlnonomnpnrntnunzomorgorgukpapepfpgphpkplplcukpmpnpostprpropsptpwpyqarerorsrurwsasbscschuksdsesgshsisjskslsmsnsosrssststoresusvsysztctdteltftgthtjtmtntotptrtraveltttvtwtzuaugukumusuyvavcvevgvivnvuwebwfwsyeytyuzazmzrzw
================================================
FILE: faker-core/src/main/res/values/lorem.xml
================================================
aliasconsequaturautperferendissitvoluptatemaccusantiumdoloremqueaperiameaqueipsaquaeabilloinventoreveritatisetquasiarchitectobeataevitaedictasuntexplicaboaspernaturautoditautfugitsedquiaconsequunturmagnidoloreseosquirationevoluptatemsequinesciuntnequedoloremipsumquiadolorsitametconsecteturadipiscivelitsedquianonnumquameiusmoditemporainciduntutlaboreetdoloremagnamaliquamquaeratvoluptatemutenimadminimaveniamquisnostrumexercitationemullamcorporisnemoenimipsamvoluptatemquiavoluptassitsuscipitlaboriosamnisiutaliquidexeacommodiconsequaturquisautemveleumiurereprehenderitquiineavoluptatevelitessequamnihilmolestiaeetiustoodiodignissimosducimusquiblanditiispraesentiumlaudantiumtotamremvoluptatumdelenitiatquecorruptiquosdoloresetquasmolestiasexcepturisintoccaecaticupiditatenonprovidentsedutperspiciatisundeomnisistenatuserrorsimiliquesuntinculpaquiofficiadeseruntmollitiaanimiidestlaborumetdolorumfugaetharumquidemrerumfacilisestetexpeditadistinctionamliberotemporecumsolutanobisesteligendioptiocumquenihilimpeditquoporroquisquamestquiminusidquodmaximeplaceatfacerepossimusomnisvoluptasassumendaestomnisdolorrepellendustemporibusautemquibusdametautconsequaturvelillumquidoloremeumfugiatquovoluptasnullapariaturatveroeosetaccusamusofficiisdebitisautrerumnecessitatibussaepeevenietutetvoluptatesrepudiandaesintetmolestiaenonrecusandaeitaqueearumrerumhicteneturasapientedelectusutautreiciendisvoluptatibusmaioresdoloribusasperioresrepellat
================================================
FILE: faker-core/src/main/res/values/names.xml
================================================
AaliyahAaronAbagailAbbeyAbbieAbbigailAbbyAbdielAbdulAbdullahAbeAbelAbelardoAbigailAbigaleAbigayleAbnerAbrahamAdaAdahAdalbertoAdalineAdamAdanAddieAddisonAdelaAdelbertAdeleAdeliaAdelineAdellAdellaAdelleAdityaAdolfAdolfoAdolphAdolphusAdonisAdrainAdrianAdrianaAdriannaAdrielAdrienAdrienneAftonAglaeAgnesAgustinAgustinaAhmadAhmedAidaAidanAidenAileenAimeeAishaAiyanaAkeemAlAlainaAlanAlanaAlanisAlannaAlaynaAlbaAlbertAlbertaAlberthaAlbertoAlbinAlbinaAldaAldenAlecAleenAlejandraAlejandrinAlekAlenaAleneAlessandraAlessandroAlessiaAlethaAlexAlexaAlexanderAlexandraAlexandreAlexandreaAlexandriaAlexandrineAlexandroAlexaneAlexanneAlexieAlexisAlexysAlexzanderAlfAlfonsoAlfonzoAlfordAlfredAlfredaAlfredoAliAliaAliceAliciaAlisaAlishaAlisonAliviaAliyaAliyahAlizaAlizeAllanAllenAlleneAllieAllisonAllyAlphonsoAltaAltheaAlvaAlvahAlvenaAlveraAlvertaAlvinaAlvisAlyceAlyciaAlysaAlyshaAlysonAlyssonAmaliaAmandaAmaniAmaraAmariAmayaAmberAmbroseAmeliaAmelieAmelyAmericaAmericoAmieAminaAmirAmiraAmiyaAmosAmparoAmyAmyaAnaAnabelAnabelleAnahiAnaisAnastacioAnastasiaAndersonAndreAndreaneAndreanneAndresAndrewAndyAngelAngelaAngelicaAngelinaAngelineAngelitaAngeloAngieAngusAnibalAnikaAnissaAnitaAniyaAniyahAnjaliAnnaAnnabelAnnabellAnnabelleAnnaliseAnnamaeAnnamarieAnneAnnettaAnnetteAnnieAnselAnsleyAnthonyAntoinetteAntoneAntonettaAntonetteAntoniaAntoniettaAntoninaAntonioAntwanAntwonAnyaAprilAraAraceliAracelyArchArchibaldArdellaArdenArdithArelyAriArianeAriannaAricArielArielleArjunArleneArlieArloArmandArmandoArmaniArnaldoArneArnoArnoldArnoldoArnulfoAronArtArthurArturoArvelArvidArvillaAryannaAsaAshaAshleeAshleighAshleyAshlyAshlynnAshtonAshtynAsiaAssuntaAstridAthenaAubreeAubreyAudieAudraAudreanneAudreyAugustAugustaAugustineAugustusAureliaAurelieAurelioAuroreAustenAustinAustynAutumnAvaAveryAvisAxelAyanaAydenAylaAylinBabyBaileeBaileyBarbaraBarneyBaronBarrettBarryBartBartholomeBartonBayleeBeatriceBeauBeaulahBellBellaBelleBenBenedictBenjaminBennettBennieBennyBentonBereniceBernadetteBernadineBernardBernardoBerneiceBernhardBerniceBernieBernieceBernitaBerryBertBertaBerthaBertramBertrandBerylBessieBethBethanyBethelBetsyBetteBettieBettyBettyeBeulahBeverlyBiankaBillBillieBillyBirdieBlairBlaiseBlakeBlancaBlancheBlazeBoBobbieBobbyBonitaBonnieBorisBoydBradBradenBradfordBradleyBradlyBradyBraedenBrainBrandiBrandoBrandonBrandtBrandyBrandynBrannonBransonBrantBraulioBraxtonBrayanBreanaBreannaBreanneBrendaBrendanBrendenBrendonBrennaBrennanBrennonBrentBretBrettBriaBrianBrianaBrianneBriceBridgetBridgetteBridieBrielleBrigitteBrionnaBrisaBritneyBrittanyBrockBroderickBrodyBrookBrookeBrooklynBrooksBrownBruceBryanaBryceBrycenBryonBuckBudBuddyBufordBulahBurdetteBurleyBurniceBusterCadeCadenCaesarCaitlynCaleCalebCaleighCaliCalistaCallieCamdenCameronCamilaCamillaCamilleCamrenCamronCamrynCamylleCandaceCandelarioCandiceCandidaCandidoCaraCareyCarissaCarleeCarletonCarleyCarliCarlieCarloCarlosCarlottaCarmelCarmelaCarmellaCarmeloCarmenCarmineCarolCarolanneCaroleCarolinaCarolineCarolynCarolyneCarrieCarrollCarsonCarterCaryCasandraCaseyCasimerCasimirCasperCassandraCassandreCassidyCassieCatalinaCaterinaCatharineCatherineCathrineCathrynCathyCaylaCeasarCeceliaCecilCecileCeciliaCedrickCelestineCelestinoCeliaCelineCesarChadChaddChadrickChaimChanceChandlerChanelChanelleCharityCharleneCharlesCharleyCharlieCharlotteChaseChasityChaunceyChayaChazChelseaChelseyChelsieChesleyChesterChetCheyanneCheyenneChloeChrisChristChristaChristelleChristianChristianaChristinaChristineChristopChristopheChristopherChristyChynaCiaraCiceroCieloCierraCindyCitlalliClairClaireClaraClarabelleClareClarissaClarkClaudClaudeClaudiaClaudieClaudineClayClemensClementClementinaClementineClemmieCleoCleoraCletaCletusCleveClevelandCliffordCliftonClintClintonClotildeClovisCloydClydeCobyCodyColbyColeColemanColinColleenCollinColtColtenColtonColumbusConcepcionConnerConnieConnorConorConradConstanceConstantinConsueloCooperCoraCoralieCorbinCordeliaCordellCordiaCordieCoreneCorineCorneliusCornellCorrineCortezCortneyCoryCotyCourtneyCoyCraigCrawfordCreolaCristalCristianCristinaCristobalCristopherCruzCrystalCrystelCullenCurtCurtisCydneyCynthiaCyrilCyrusDagmarDahliaDaijaDaishaDaisyDakotaDaleDallasDallinDaltonDamarisDameonDamianDamienDamionDamonDanDanaDandreDaneDangeloDangeloDanialDanielaDaniellaDanielleDanikaDannieDannyDanteDanykaDaphneDaphneeDaphneyDarbyDarenDarianDarianaDarienDarioDarionDariusDarleneDaronDarrelDarrellDarrenDarrickDarrinDarrionDarronDarrylDarwinDarylDashawnDasiaDaveDavidDavinDavionDavonDavonteDawnDawsonDaxDayanaDaynaDayneDaytonDeanDeangeloDeannaDeborahDeclanDedricDedrickDeeDeionDejaDejahDejonDejuanDelaneyDelbertDelfinaDeliaDelilahDellDellaDelmerDeloresDelphaDelphiaDelphineDeltaDemarcoDemarcusDemarioDemetrisDemetriusDemondDenaDenisDennisDeonDeondreDeontaeDeonteDereckDerekDerickDeronDerrickDeshaunDeshawnDesireeDesmondDessieDestanyDestinDestineeDestineyDestiniDestinyDevanDevanteDevenDevinDevonDevonteDevynDewayneDewittDexterDiamondDianaDiannaDiegoDillanDillonDimitriDinaDinoDionDixieDockDollyDoloresDomenicDomenicaDomenickDomenicoDomingoDominicDominiqueDonDonaldDonatoDonavonDonnaDonnellDonnieDonnyDoraDorcasDorianDorisDorotheaDorothyDorrisDorthaDorthyDougDouglasDovieDoyleDrakeDrewDuaneDudleyDulceDuncanDurwardDustinDustyDwightDylanEarlEarleneEarlineEarnestEarnestineEasterEastonEbbaEbonyEdEdaEddEddieEdenEdgarEdgardoEdisonEdmondEdmundEdnaEduardoEdwardEdwardoEdwinEdwinaEdythEdytheEffieEfrainEfrenEileenEinarEinoEladioElainaElbertEldaEldonEldoraEldredEldridgeEleanoraEleanoreEleazarElectaElenaElenorElenoraEleonoreElfriedaEliElianElianeEliasEliezerElijahElinorElinoreElisaElisabethEliseEliseoElishaElissaElizaElizabethEllaEllenEllieElliotElliottEllisEllsworthElmerElmiraElmoElmoreElnaElnoraElodyEloisaEloiseElouiseEloyElroyElsaElseElsieEltaEltonElvaElveraElvieElvisElwinElwynElyseElyssaElzaEmanuelEmeliaEmelieEmelyEmeraldEmersonEmeryEmieEmilEmileEmiliaEmilianoEmilieEmilioEmilyEmmaEmmaleeEmmanuelEmmanuelleEmmetEmmettEmmieEmmittEmmyEmoryEnaEnidEnochEnolaEnosEnricoEnriqueEphraimEraEribertoEricEricaErichErickErickaErikErikaErinErlingErnaErnestErnestinaErnestineErnestoErnieErvinErwinErynEsmeraldaEsperanzaEstaEstebanEstefaniaEstelEstellEstellaEstelleEstevanEstherEstrellaEthaEthanEthelEthelynEthylEttieEudoraEugeneEugeniaEulaEulahEulaliaEunaEuniceEusebioEvaEvalynEvanEvangelineEvansEveEvelineEvelynEverardoEverettEveretteEvertEvieEwaldEwellEzekielEzequielEzraFabianFabiolaFaeFannieFannyFatimaFaustinoFaustoFavianFayFayeFedericoFeliciaFelicitaFelicityFelipaFelipeFelixFeltonFerminFernFernandoFerneFidelFilibertoFilomenaFinnFionaFlavieFlavioFletaFletcherFloFlorenceFlorencioFlorianFloridaFlorineFlossieFloyFloydFordForestForrestFosterFrancesFrancescaFrancescoFrancisFranciscaFranciscoFrancoFrankFrankieFranzFredFredaFreddieFreddyFredericFrederickFrederikFrederiqueFredrickFredyFreedaFreemanFreidaFridaFriedaFriedrichFritzFurmanGabeGabrielGabriellaGabrielleGaetanoGageGailGardnerGarettGarfieldGarlandGarnetGarnettGarretGarrettGarrickGarrisonGarryGarthGastonGavinGayGayleGaylordGeneGeneralGenesisGenevieveGennaroGenovevaGeoGeoffreyGeorgeGeorgetteGeorgianaGeorgiannaGeovanniGeovannyGeovanyGeraldGeraldineGerardGerardoGerdaGerhardGermaineGermanGerryGersonGertrudeGiaGianniGideonGilbertGilbertoGildaGilesGillianGinaGinoGiovaniGiovannaGiovanniGiovannyGisselleGiuseppeGladyceGladysGlenGlendaGlennaGlennieGloriaGodfreyGoldaGoldenGonzaloGordonGraceGracieGracielaGradyGrahamGrantGranvilleGrayceGraysonGreenGregGreggGregoriaGregorioGregoryGretaGretchenGreysonGriffinGroverGuadalupeGudrunGuidoGuillermoGuiseppeGunnarGunnerGusGussieGustGustaveGuyGwenGwendolynHadleyHaileeHaileyHailieHalHaleighHaleyHalieHalleHallieHankHannaHannahHansHardyHarleyHarmonHarmonyHaroldHarrisonHarryHarveyHaskellHassanHassieHattieHavenHaydenHayleeHayleyHaylieHazelHazleHeathHeatherHeavenHeberHectorHeidiHelenHelenaHeleneHelgaHellenHelmerHeloiseHendersonHenriHenrietteHenryHerbertHermanHermannHerminaHerminiaHerminioHershelHertaHerthaHesterHettieHilarioHilbertHildaHildegardHillardHillaryHilmaHiltonHipolitoHiramHobartHoldenHollieHollisHollyHopeHoraceHoracioHortenseHoseaHoustonHowardHowellHoytHubertHudsonHughHuldaHumbertoHunterHymanIanIbrahimIcieIdaIdellIdellaIgnacioIgnatiusIkeIlaIleneIlianaImaImaniImeldaImmanuelImogeneInesIrmaIrvingIrwinIsaacIsabelIsabellIsabellaIsabelleIsacIsadoreIsaiIsaiahIsaiasIsidroIsmaelIsobelIsomIsraelIssacItzelIvaIvahIvoryIvyIzabellaIzaiahJabariJaceJaceyJacintheJacintoJackJackelineJackieJacklynJacksonJackyJaclynJacquelynJacquesJacyntheJadaJadeJadenJadonJadynJaedenJaidaJaidenJailynJaimeJairoJakaylaJakeJakobJaleelJalenJalonJalynJamaalJamalJamarJamarcusJamelJamesonJameyJamieJamilJamirJamisonJammieJanJanaJanaeJaneJanelleJanessaJanetJaniceJanickJanieJanisJaniyaJannieJanyJaquanJaquelinJaquelineJaredJarenJarodJaronJarredJarrellJarretJarrettJarrodJarvisJasenJasminJasonJasperJaunitaJavierJavonJavonteJayJayceJayceeJaydaJaydeJaydenJaydonJaylanJaylenJaylinJaylonJaymeJayneJaysonJazlynJazminJazmynJazmyneJeanJeanetteJeanieJeanneJedJedediahJedidiahJeffJeffereyJefferyJeffreyJeffryJenaJeniferJennieJenniferJenningsJennyferJensenJeradJeraldJeramieJeramyJerelJeremieJeremyJermainJermaineJermeyJerodJeromeJeromyJerrellJerrodJerroldJerryJessJesseJessicaJessieJessikaJessyJessycaJesusJettJettieJevonJewelJewellJillianJimmieJimmyJoJoanJoanaJoanieJoanneJoannieJoannyJoanyJoaquinJocelynJodieJodyJoeJoelJoelleJoesphJoeyJohanJohannJohannaJohathanJohnJohnathanJohnathonJohnnieJohnnyJohnpaulJohnsonJolieJonJonasJonatanJonathanJonathonJordanJordaneJordiJordonJordyJordynJorgeJoseJosefaJosefinaJosephJosephineJoshJoshuaJoshuahJosiahJosianeJosianneJosieJosueJovanJovaniJovannyJovanyJoyJoyceJuanaJuanitaJudahJuddJudeJudgeJudsonJudyJulesJuliaJulianJulianaJulianneJulieJulienJulietJulioJuliusJuneJuniorJuniusJustenJusticeJustinaJustineJustonJustusJustynJuvenalJuwanKaceyKaciKacieKadeKadenKadinKaelaKaelynKaiaKaileeKaileyKailynKaitlinKaitlynKaleKalebKaleighKaleyKaliKallieKameronKamilleKamrenKamronKamrynKaneKaraKareemKarelleKarenKariKarianeKarianneKarinaKarineKarlKarleeKarleyKarliKarlieKarolannKarsonKasandraKaseyKassandraKatarinaKatelinKatelynKatelynnKatharinaKatherineKatherynKathleenKathlynKathrynKathryneKatlynKatlynnKatrinaKatrineKattieKavonKayKayaKayceeKaydenKaylaKaylahKayleeKayleighKayleyKayliKaylieKaylinKeaganKeanuKearaKeatonKeeganKeeleyKeelyKeenanKeiraKeithKellenKelleyKelliKellieKellyKelsiKelsieKeltonKelvinKenKendallKendraKendrickKennaKennediKennedyKennethKennithKennyKentonKenyaKenyattaKenyonKeonKeshaunKeshawnKevenKevinKevonKeyonKeyshawnKhalidKhalilKianKianaKiannaKiaraKiarraKielKieraKieranKileyKimKimberlyKingKipKiraKirkKirstenKirstinKittyKobeKobyKodyKolbyKoleKorbinKoreyKoryKraigKrisKristaKristianKristinKristinaKristoferKristofferKristopherKristyKrystalKrystelKrystinaKurtKurtisKylaKyleKyleeKyleighKylerKylieKyraLaceyLacyLadariusLafayetteLailaLaishaLamarLambertLamontLanceLandenLaneLaneyLarissaLaronLarryLarueLauraLaurelLaurenLaurenceLaurettaLaurianeLaurianneLaurieLaurineLauryLaurynLavadaLavernLavernaLaverneLavinaLaviniaLavonLavonneLawrenceLawsonLaylaLayneLazaroLeaLeannLeannaLeanneLeathaLedaLeeLeifLeilaLeilaniLelaLelahLelandLeliaLempiLemuelLennaLennieLennyLenoraLenoreLeoLeolaLeonLeonardLeonardoLeoneLeonelLeonieLeonorLeonoraLeopoldLeopoldoLeoraLeraLesleyLeslieLeslyLessieLesterLetaLethaLetitiaLeviLewLewisLexiLexieLexusLiaLiamLianaLibbieLibbyLilaLilianLilianaLilianeLillaLillianLillianaLillieLillyLilyLilyanLinaLincolnLindaLindsayLindseyLinneaLinnieLinwoodLionelLisaLisandroLisetteLitzyLizaLizethLizzieLlewellynLloydLoganLoisLolaLolitaLomaLonLondonLonieLonnieLonnyLonzoLoraLoraineLorenLorenaLorenzLorenzaLorenzoLoriLorineLornaLottieLouLouieLouisaLourdesLouveniaLowellLoyLoyalLoyceLucasLucianoLucieLucienneLucileLucindaLucioLuciousLuciusLucyLudieLudwigLueLuellaLuigiLuisLuisaLukasLulaLuluLunaLupeLuraLurlineLutherLuzLydaLydiaLylaLynnLyricLysanneMabelMabelleMableMacMaceyMaciMacieMackMackenzieMacyMadalineMadalynMaddisonMadelineMadelynMadelynnMadgeMadieMadilynMadisenMadisonMadisynMadonnaMadysonMaeMaeganMaeveMafaldaMagaliMagdalenMagdalenaMaggieMagnoliaMagnusMaiaMaidaMaiyaMajorMakaylaMakennaMakenzieMalachiMalcolmMalikaMalindaMallieMalloryMalvinaMandyManleyManuelManuelaMaraMarcMarcelMarcelinaMarcelinoMarcellaMarcelleMarcellusMarceloMarciaMarcoMarcosMarcusMargaretMargareteMargarettMargarettaMargaretteMargaritaMargeMargieMargotMargretMargueriteMariaMariahMariamMarianMarianaMarianeMariannaMarianneMarianoMaribelMarieMarielaMarielleMariettaMarilieMarilouMarilyneMarinaMarioMarionMarisaMarisolMaritzaMarjolaineMarjorieMarjoryMarkMarkusMarleeMarlenMarleneMarleyMarlinMarlonMarquesMarquisMarquiseMarshallMartaMartinMartinaMartineMartyMarvinMaryMaryamMaryjaneMaryseMasonMateoMathewMathiasMathildeMatildaMatildeMattMatteoMattieMaudMaudeMaudieMaureenMauriceMauricioMaurineMaverickMavisMaxMaxieMaximeMaximilianMaximilliaMaximillianMaximoMaximusMaxineMaxwellMayMayaMaybellMaybelleMayeMaymieMaynardMayraMazieMckaylaMckennaMckenzieMeaganMeaghanMedaMeganeMeggieMeghanMekhiMelanyMelbaMelisaMelissaMellieMelodyMelvinMelvinaMelynaMelyssaMercedesMeredithMerlMerleMerlinMerrittMertieMervinMetaMiaMicaelaMicahMichaelMichaelaMichaleMichealMichelMicheleMichelleMiguelMikaylaMikeMikelMilanMilesMilfordMillerMillieMiloMiltonMinaMinervaMinnieMiracleMireilleMireyaMisaelMissouriMistyMitchelMitchellMittieModestaModestoMohamedMohammadMohammedMoisesMollieMollyMonaMonicaMoniqueMonroeMonserratMonserrateMontanaMonteMontyMorganMoriahMorrisMortimerMortonMoseMosesMosheMossieMozellMozelleMuhammadMurielMurlMurphyMurrayMustafaMyaMyahMyleneMylesMyraMyriamMyrlMyrnaMyronMyrticeMyrtieMyrtisMyrtleNadiaNakiaNameNannieNaomiNaomieNapoleonNarcisoNashNasirNatNataliaNatalieNatashaNathanNathanaelNathanialNathanielNathenNayeliNealNedNedraNehaNeilNeldaNellaNelleNellieNelsNelsonNeomaNestorNettieNevaNewellNewtonNiaNicholasNicholausNicholeNickNicklausNickolasNicoNicolaNicolasNicoleNicoletteNigelNikitaNikkiNikkoNikoNikolasNilsNinaNoahNobleNoeNoelNoeliaNoemiNoemieNoemyNolaNolanNonaNoraNorbertNorbertoNoreneNormaNorrisNorvalNorwoodNovaNovellaNyaNyahNyasiaObieOceaneOcieOctaviaOdaOdellOdessaOdieOfeliaOkeyOlaOlafOleOlenOletaOlgaOlinOliverOllieOmaOmariOmerOnaOnieOpalOpheliaOraOralOranOrenOrieOrinOrionOrlandOrlandoOrloOrphaOrrinOrvalOrvilleOsbaldoOsborneOscarOsvaldoOswaldOswaldoOthaOthoOtiliaOtisOttilieOttisOttoOvaOwenOzellaOzziePabloPaigePalmaPamelaPansyPaoloParisParkerPascalePasqualePatPatiencePatriciaPatrickPatsyPattiePaulPaulaPaulinePaxtonPaytonPearlPearliePearlinePedroPeggiePenelopePercivalPercyPerryPetePeterPetraPeytonPhilipPhoebePhyllisPiercePierrePietroPinkPinkiePiperPollyPorterPreciousPresleyPrestonPricePrincePrincessPriscillaProvidenciPrudenceQueenQueenieQuentinQuincyQuinnQuintenQuintonRachaelRachelRachelleRaeRaeganRafaelRafaelaRaheemRahsaanRahulRainaRaleighRalphRamiroRamonRamonaRandalRandallRandiRandyRansomRaoulRaphaelRaphaelleRaquelRashadRashawnRasheedRaulRavenRayRaymondRaymundoReaganReannaRebaRebecaRebeccaRebekaRebekahReeceReedReeseReganReggieReginaldReidReillyReinaReinholdRemingtonReneReneeRessieRetaRethaRettaReubenRevaRexReyReyesReymundoReynaReynoldRheaRhettRhiannaRhiannonRhodaRicardoRichardRichieRichmondRickRickeyRickieRickyRicoRigobertoRileyRitaRiverRobbRobbieRobertRobertaRobertoRobinRobynRocioRockyRodRoderickRodgerRodolfoRodrickRodrigoRoelRogelioRogerRogersRolandoRollinRomaRomaineRomanRonRonaldoRonnyRooseveltRoryRosaRosaleeRosaliaRosalindRosalindaRosalynRosamondRosannaRosarioRoscoeRoseRosellaRoselynRosemarieRosemaryRosendoRosettaRosieRosinaRoslynRossRossieRowanRowenaRowlandRoxaneRoxanneRoyRoyalRoyceRozellaRubenRubieRubyRubyeRudolphRudyRupertRussRusselRussellRustyRuthRutheRuthieRyanRyannRyderRylanRyleeRyleighRyleySabinaSabrinaSabrynaSadieSadyeSageSaigeSallieSallySalmaSalvadorSalvatoreSamSamantaSamanthaSamaraSamirSammieSammySamsonSandraSandrineSandySanfordSantaSantiagoSantinaSantinoSantosSarahSaraiSarinaSashaSaulSavanahSavannaSavannahSavionScarlettSchuylerScotScottieScottySeamusSeanSebastianSedrickSelenaSelinaSelmerSerenaSerenitySethShadShainaShakiraShanaShaneShanelShanelleShaniaShanieShaniyaShannaShannonShannyShanonShanySharonShaunShawnShawnaShayleeShaynaShayneSheaSheilaSheldonShemarSheridanShermanSherwoodShirleyShyannShyanneSibylSidSidneySiennaSierraSigmundSigridSigurdSilasSimSimeonSimoneSincereSisterSkyeSkylaSkylarSofiaSoledadSolonSoniaSonnySonyaSophiaSophieSpencerStaceyStacyStanStanfordStanleyStantonStefanStefanieStellaStephanStephaniaStephanieStephanyStephenStephonSterlingSteveStevieStewartStoneStuartSummerSunnySusanSusanaSusannaSusieSuzanneSvenSybleSydneeSydneySydniSydnieSylvanSylvesterSylviaTabithaTadTaliaTalonTamaraTamiaTaniaTannerTanyaTaraTarynTateTatumTatyanaTaureanTavaresTayaTaylorTeaganTedTellyTerenceTeresaTerranceTerrellTerrenceTerrillTerryTessTessieTevinThadThaddeusThaliaTheaThelmaTheoTheodoraTheodoreTheresaThereseTheresiaTheronThomasThoraThurmanTiaTianaTiannaTiaraTierraTiffanyTillmanTimmothyTimmyTimothyTinaTitoTitusTobinTobyTodTomTomasTomasaTommieToneyToniTonyToreyTorranceTorreyToyTraceTraceyTracyTravisTravonTreTremaineTremayneTrentTrentonTressaTressieTrevaTreverTrevionTrevorTreyTrinityTrishaTristianTristinTristonTroyTrudieTryciaTrystanTurnerTwilaTylerTyraTyreeTyreekTyrelTyrellTyreseTyriqueTyshawnTysonUbaldoUlicesUlisesUnaUniqueUrbanUriahUrielUrsulaVadaValentinValentinaValentineValerieVallieVanVanceVanessaVaughnVedaVeldaVellaVelmaVelvaVenaVerdaVerdieVergieVerlaVerlieVernVernaVernerVerniceVernieVernonVeronaVeronicaVestaVicentaVicenteVickieVickyVictorVictoriaVidaVidalVilmaVinceVincentVincenzaVincenzoVinnieViolaVioletVioletteVirgieVirgilVirginiaVirginieVitaVitoVivaVivianVivianeVivianneVivienVivienneVladimirWadeWainoWaldoWalkerWallaceWalterWaltonWandaWardWarrenWatsonWavaWaylonWayneWebsterWeldonWellingtonWendellWendyWernerWestleyWestonWhitneyWilberWilbertWilburnWileyWilfordWilfredWilfredoWilfridWilhelmWilhelmineWillWillaWillardWilliamWillieWillisWillowWillyWilmaWilmerWilsonWiltonWinfieldWinifredWinnifredWinonaWinstonWoodrowWyattWymanXanderXavierXzavierYadiraYasmeenYasminYasmineYazminYeseniaYesseniaYolandaYoshikoYvetteYvonneZachariahZacharyZacheryZackZackaryZackeryZakaryZanderZaneZariaZechariahZeldaZellaZelmaZenaZettaZionZitaZoeZoeyZoieZoilaZolaZoraZulaAbbottAbernathyAbshireAdamsAltenwerthAndersonAnkundingArmstrongAuerAufderharBahringerBaileyBalistreriBarrowsBartellBartolettiBartonBashirianBatzBauchBaumbachBayerBeahanBeattyBechtelarBeckerBednarBeerBeierBergeBergnaumBergstromBernhardBernierBinsBlandaBlickBlockBodeBoehmBoganBogisichBorerBoscoBotsfordBoyerBoyleBradtkeBrakusBraunBreitenbergBrekkeBrownBruenBuckridgeCarrollCarterCartwrightCasperCassinChamplinChristiansenColeCollierCollinsConnConnellyConroyConsidineCorkeryCormierCorwinCreminCristCronaCroninCrooksCruickshankCummerataCummingsDachDAmoreDanielDareDaughertyDavisDeckowDenesikDibbertDickensDickiDickinsonDietrichDonnellyDooleyDouglasDoyleDuBuqueDurganEbertEffertzEichmannEmardEmmerichErdmanErnserFadelFaheyFarrellFayFeeneyFeestFeilFerryFisherFlatleyFramiFraneckiFriesenFritschFunkGaylordGerholdGerlachGibsonGislasonGleasonGleichnerGloverGoldnerGoodwinGorczanyGottliebGoyetteGradyGrahamGrantGreenGreenfelderGreenholtGrimesGulgowskiGusikowskiGutkowskiGutmannHaagHackettHagenesHahnHaleyHalvorsonHamillHammesHandHaneHansenHarberHarrisHartmannHarveyHauckHayesHeaneyHeathcoteHegmannHeidenreichHellerHermanHermannHermistonHerzogHesselHettingerHickleHilllHillsHilpertHintzHirtheHodkiewiczHoegerHomenickHoppeHoweHowellHudsonHuelHuelsHyattJacobiJacobsJacobsonJakubowskiJaskolskiJastJenkinsJerdeJohnsJohnsonJohnstonJonesKassulkeKautzerKeeblerKeelingKemmerKerlukeKertzmannKesslerKiehnKihnKilbackKingKirlinKleinKlingKlockoKochKoelpinKoeppKohlerKonopelskiKossKovacekKozeyKrajcikKreigerKrisKshlerinKubKuhicKuhlmanKuhnKulasKundeKunzeKuphalKutchKuvalisLabadieLakinLangLangoshLangworthLarkinLarsonLeannonLebsackLednerLefflerLegrosLehnerLemkeLeschLeuschkeLindLindgrenLittelLittleLockmanLoweLubowitzLueilwitzLuettgenLynchMacejkovicMacGyverMaggioMannManteMarksMarquardtMarvinMayerMayertMcClureMcCulloughMcDermottMcGlynnMcKenzieMcLaughlinMedhurstMertzMetzMillerMillsMitchellMoenMohrMonahanMooreMorarMorissetteMosciskiMrazMuellerMullerMurazikMurphyMurrayNaderNicolasNienowNikolausNitzscheNolanOberbrunnerOConnellOConnerOHaraOKeefeOKonOkunevaOlsonOndrickaOReillyOrnOrtizOsinskiPacochaPadbergPagacParisianParkerPaucekPfannerstillPfefferPollichPourosPowlowskiPredovicPriceProhaskaProsaccoPurdyQuigleyQuitzonRathRatkeRauRaynorReichelReichertReillyReingerRempelRennerReynoldsRiceRippinRitchieRobelRobertsRodriguezRogahnRohanRolfsonRomagueraRoobRosenbaumRoweRueckerRunolfsdottirRunolfssonRunteRusselRutherfordRyanSanfordSatterfieldSauerSawaynSchadenSchaeferSchambergerSchillerSchimmelSchinnerSchmelerSchmidtSchmittSchneiderSchoenSchowalterSchroederSchulistSchultzSchummSchuppeSchusterSengerShanahanShieldsSimonisSipesSkilesSmithSmithamSpencerSpinkaSporerStammStantonStarkStehrSteuberStiedemannStokesStoltenbergStrackeStreichStromanStrosinSwaniawskiSwiftTerryThielThompsonTillmanTorpTorphyTowneToyTrantowTremblayTreutelTrompTurcotteTurnerUllrichUptonVandervortVeumVolkmanVonVonRuedenWaelchiWalkerWalshWalterWardWatersWatsicaWeberWehnerWeimannWeissnatWelchWestWhiteWiegandWildermanWilkinsonWillWilliamsonWillmsWindlerWintheiserWisokyWisozkWittingWizaWolfWolffWuckertWunschWymanYostYundtZboncakZemlakZiemannZiemeZulaufMr.Mrs.Ms.MissDr.Jr.Sr.IIIIIIIVVMDDDSPhDDVMLeadSeniorDirectCorporateDynamicFutureProductNationalRegionalDistrictCentralGlobalCustomerInvestorDynamicInternationalLegacyForwardInternalHumanChiefPrincipalSolutionsProgramBrandSecurityResearchMarketingDirectivesImplementationIntegrationFunctionalityResponseParadigmTacticsIdentityMarketsGroupDivisionApplicationsOptimizationOperationsInfrastructureIntranetCommunicationsWebBrandingQualityAssuranceMobilityAccountsDataCreativeConfigurationAccountabilityInteractionsFactorsUsabilityMetricsSupervisorAssociateExecutiveLiaisonOfficerManagerEngineerSpecialistDirectorCoordinatorAdministratorArchitectAnalystDesignerPlannerOrchestratorTechnicianDeveloperProducerConsultantAssistantFacilitatorAgentRepresentativeStrategist
================================================
FILE: faker-core/src/main/res/values/phones.xml
================================================
(###) ###-######-###-####
================================================
FILE: faker-core/src/main/res/values/strings.xml
================================================
Faker
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Tue Sep 05 15:21:03 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
================================================
FILE: gradle.properties
================================================
================================================
FILE: gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: maven_push.gradle
================================================
apply plugin: 'maven'
apply plugin: 'signing'
def sonatypeRepositoryUrl
if (isReleaseBuild()) {
println 'RELEASE BUILD'
sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
println 'DEBUG BUILD'
sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}
def getRepositoryUsername() {
return hasProperty('nexusUsername') ? nexusUsername : ""
}
def getRepositoryPassword() {
return hasProperty('nexusPassword') ? nexusPassword : ""
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
pom.artifactId = POM_ARTIFACT_ID
repository(url: sonatypeRepositoryUrl) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.sourceFiles
}
task androidJavadocsJar(type: Jar) {
classifier = 'javadoc'
//basename = artifact_id
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
//basename = artifact_id
from android.sourceSets.main.java.sourceFiles
}
artifacts {
//archives packageReleaseJar
archives androidSourcesJar
archives androidJavadocsJar
}
}
================================================
FILE: settings.gradle
================================================
include ':app', ':faker-core'