├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── manojbhadane
│ │ │ │ └── easyretrosample
│ │ │ │ ├── ApiService.java
│ │ │ │ ├── App.java
│ │ │ │ ├── ResModel.java
│ │ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── manojbhadane
│ │ │ └── easyretrosample
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── manojbhadane
│ │ └── easyretrosample
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── easyretro
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── manojbhadane
│ │ └── easyretro
│ │ ├── ResponseListener.java
│ │ ├── EasyRetro.java
│ │ ├── RetrofitInstance.java
│ │ └── MakeRequest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── encodings.xml
├── compiler.xml
├── vcs.xml
├── misc.xml
├── gradle.xml
└── jarRepositories.xml
├── script.sh
├── .gitignore
├── gradle.properties
├── sample.txt
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/easyretro/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':easyretro'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EasyRetroSample
3 |
4 |
--------------------------------------------------------------------------------
/easyretro/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EasyRetro
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manojbhadane/EasyRetro/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/script.sh:
--------------------------------------------------------------------------------
1 |
2 | for i in 1 2 3 4 5 6 7 8
3 | do
4 | echo "------------------"
5 | echo "Commit Number : $i"
6 | echo "some data" >> sample.txt
7 | git add .
8 | git commit -m "minor changes"
9 | git push origin master
10 | done
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 25 12:13:13 IST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/easyretro/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/easyretro/src/main/java/com/manojbhadane/easyretro/ResponseListener.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretro;
2 |
3 | import retrofit2.Response;
4 |
5 | public interface ResponseListener {
6 | void onResponse(D model, Response response);
7 |
8 | void onError(String msg, Response response);
9 |
10 | // public void showHideProgress(boolean shouldShow);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/manojbhadane/easyretrosample/ApiService.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretrosample;
2 |
3 | import okhttp3.ResponseBody;
4 | import retrofit2.Call;
5 | import retrofit2.http.GET;
6 | import retrofit2.http.Url;
7 |
8 | public interface ApiService {
9 |
10 | @GET
11 | public Call test(@Url String url);
12 |
13 | @GET
14 | public Call test1();
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/manojbhadane/easyretrosample/App.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretrosample;
2 |
3 | import android.app.Application;
4 |
5 | import com.manojbhadane.easyretro.EasyRetro;
6 |
7 | public class App extends Application {
8 |
9 | @Override
10 | public void onCreate() {
11 | super.onCreate();
12 |
13 | EasyRetro.init(getApplicationContext(),"https://reqres.in/api/users/");
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/manojbhadane/easyretrosample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretrosample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/easyretro/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/manojbhadane/easyretrosample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretrosample;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.InstrumentationRegistry;
6 | import androidx.test.runner.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getTargetContext();
24 |
25 | assertEquals("com.manojbhadane.easyretrosample", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/easyretro/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 32
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 15
10 | targetSdkVersion 32
11 |
12 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
13 |
14 | }
15 |
16 | compileOptions {
17 | sourceCompatibility JavaVersion.VERSION_1_8
18 | targetCompatibility JavaVersion.VERSION_1_8
19 | }
20 |
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 |
28 | }
29 |
30 | dependencies {
31 |
32 | /* Retrofit */
33 | implementation 'com.squareup.retrofit2:retrofit:2.9.0'
34 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
35 | implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
36 | implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 32
5 | defaultConfig {
6 | applicationId "com.manojbhadane.easyretrosample"
7 | minSdkVersion 15
8 | targetSdkVersion 32
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12 | }
13 |
14 | compileOptions {
15 | sourceCompatibility JavaVersion.VERSION_1_8
16 | targetCompatibility JavaVersion.VERSION_1_8
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 |
29 | implementation 'androidx.appcompat:appcompat:1.6.0-alpha03'
30 |
31 | implementation project(':easyretro')
32 | // implementation 'com.github.manojbhadane:EasyRetro:v1.0'
33 |
34 | implementation 'com.squareup.retrofit2:retrofit:2.9.0'
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/easyretro/src/main/java/com/manojbhadane/easyretro/EasyRetro.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretro;
2 |
3 | import android.content.Context;
4 |
5 | import retrofit2.Call;
6 |
7 | //Version Commit guide on Jitpack , execute following commands
8 | //
9 | //git tag -a v1.0 -m "first commit"
10 | //git push origin v1.2
11 |
12 | //Visit https://jitpack.io to build library
13 |
14 | public class EasyRetro {
15 |
16 | public static void init(Context context, String baseUrl) {
17 | RetrofitInstance.initCache(context);
18 | RetrofitInstance.init(baseUrl);
19 | }
20 |
21 | public static T setServices(final Class service) {
22 | return RetrofitInstance.getInstance().create(service);
23 | }
24 |
25 | @SuppressWarnings("unchecked")
26 | public static void request(Call call, ResponseListener listener) {
27 | MakeRequest.getInstance().request(call, true, listener);
28 | }
29 |
30 | public static void requestStringAsResponse(Call call, ResponseListener listener) {
31 | MakeRequest.getInstance().requestStringAsResponse(call, true, listener);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/manojbhadane/easyretrosample/ResModel.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretrosample;
2 |
3 | public class ResModel {
4 |
5 | private int code;
6 | private String message;
7 | private Data data;
8 |
9 | public int getCode() {
10 | return code;
11 | }
12 |
13 | public void setCode(int code) {
14 | this.code = code;
15 | }
16 |
17 | public String getMessage() {
18 | return message;
19 | }
20 |
21 | public void setMessage(String message) {
22 | this.message = message;
23 | }
24 |
25 | public Data getData() {
26 | return data;
27 | }
28 |
29 | public void setData(Data data) {
30 | this.data = data;
31 | }
32 |
33 | public class Data{
34 | private String name;
35 | private String value;
36 |
37 | public String getName() {
38 | return name;
39 | }
40 |
41 | public void setName(String name) {
42 | this.name = name;
43 | }
44 |
45 | public String getValue() {
46 | return value;
47 | }
48 |
49 | public void setValue(String value) {
50 | this.value = value;
51 | }
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/manojbhadane/easyretrosample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretrosample;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.widget.Button;
6 | import android.widget.Toast;
7 |
8 | import com.manojbhadane.easyretro.EasyRetro;
9 | import com.manojbhadane.easyretro.ResponseListener;
10 |
11 | import androidx.appcompat.app.AppCompatActivity;
12 | import retrofit2.Call;
13 | import retrofit2.Response;
14 |
15 | public class MainActivity extends AppCompatActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_main);
21 |
22 | ((Button) findViewById(R.id.btn)).setOnClickListener(new View.OnClickListener() {
23 | @Override
24 | public void onClick(View view) {
25 | callAPI();
26 | }
27 | });
28 | }
29 |
30 | /**
31 | * Features :
32 | * 1. No need to check for internet connection each time
33 | * 2. Intelligent crash handling at the time of response parsing
34 | * 3. Easy to Use
35 | * 4. Minimal configuration
36 | *
37 | *
38 | */
39 |
40 | private void callAPI() {
41 |
42 | ApiService apiService = EasyRetro.setServices(ApiService.class);
43 |
44 | Call call = apiService.test("https://raw.githubusercontent.com/manojbhadane/Kotlin-LambdaExpression/master/sample.json");
45 |
46 | EasyRetro.request(call, new ResponseListener() {
47 | @Override
48 | public void onResponse(ResModel model, Response response) {
49 | Toast.makeText(MainActivity.this, model.getData().getName(), Toast.LENGTH_SHORT).show();
50 | }
51 |
52 | @Override
53 | public void onError(String msg, Response response) {
54 | Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
55 | }
56 | });
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/sample.txt:
--------------------------------------------------------------------------------
1 | some data
2 | some data
3 | some data
4 | some data
5 | some data
6 | some data
7 | some data
8 | some data
9 | some data
10 | some data
11 | some data
12 | some data
13 | some data
14 | some data
15 | some data
16 | some data
17 | some data
18 | some data
19 | some data
20 | some data
21 | some data
22 | some data
23 | some data
24 | some data
25 | some data
26 | some data
27 | some data
28 | some data
29 | some data
30 | some data
31 | some data
32 | some data
33 | some data
34 | some data
35 | some data
36 | some data
37 | some data
38 | some data
39 | some data
40 | some data
41 | some data
42 | some data
43 | some data
44 | some data
45 | some data
46 | some data
47 | some data
48 | some data
49 | some data
50 | some data
51 | some data
52 | some data
53 | some data
54 | some data
55 | some data
56 | some data
57 | some data
58 | some data
59 | some data
60 | some data
61 | some data
62 | some data
63 | some data
64 | some data
65 | some data
66 | some data
67 | some data
68 | some data
69 | some data
70 | some data
71 | some data
72 | some data
73 | some data
74 | some data
75 | some data
76 | some data
77 | some data
78 | some data
79 | some data
80 | some data
81 | some data
82 | some data
83 | some data
84 | some data
85 | some data
86 | some data
87 | some data
88 | some data
89 | some data
90 | some data
91 | some data
92 | some data
93 | some data
94 | some data
95 | some data
96 | some data
97 | some data
98 | some data
99 | some data
100 | some data
101 | some data
102 | some data
103 | some data
104 | some data
105 | some data
106 | some data
107 | some data
108 | some data
109 | some data
110 | some data
111 | some data
112 | some data
113 | some data
114 | some data
115 | some data
116 | some data
117 | some data
118 | some data
119 | some data
120 | some data
121 | some data
122 | some data
123 | some data
124 | some data
125 | some data
126 | some data
127 | some data
128 | some data
129 | some data
130 | some data
131 | some data
132 | some data
133 | some data
134 | some data
135 | some data
136 | some data
137 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/easyretro/src/main/java/com/manojbhadane/easyretro/RetrofitInstance.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretro;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.IOException;
6 | import java.util.concurrent.TimeUnit;
7 |
8 | import okhttp3.Cache;
9 | import okhttp3.CacheControl;
10 | import okhttp3.Interceptor;
11 | import okhttp3.OkHttpClient;
12 | import okhttp3.Request;
13 | import okhttp3.Response;
14 | import okhttp3.logging.HttpLoggingInterceptor;
15 | import retrofit2.Retrofit;
16 | import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
17 | import retrofit2.converter.gson.GsonConverterFactory;
18 |
19 | public class RetrofitInstance {
20 |
21 | private static String BASE_URL;
22 | private static Retrofit retrofit;
23 |
24 | private static Cache cache;
25 |
26 | public static void initCache(Context context){
27 | // 10 MB
28 | int cacheSize = 10 * 1024 * 1024;
29 | cache = new Cache(context.getCacheDir(), cacheSize);
30 | }
31 | public static void init(String baseURL) {
32 | BASE_URL = baseURL;
33 | getInstance();
34 | }
35 |
36 | public static Retrofit getInstance() {
37 | if (retrofit == null) {
38 | HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
39 | interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
40 | OkHttpClient client = new OkHttpClient.Builder()
41 | .addInterceptor(interceptor)
42 | .addInterceptor(offlineInterceptor())
43 | .addNetworkInterceptor(onlineInterceptor())
44 | .cache(cache)
45 | .build();
46 |
47 | retrofit = new Retrofit.Builder()
48 | .baseUrl(BASE_URL)
49 | .addConverterFactory(GsonConverterFactory.create())
50 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
51 | .client(client)
52 | .build();
53 | }
54 | return retrofit;
55 | }
56 |
57 | public static T getService(final Class service) {
58 | return getInstance().create(service);
59 | }
60 |
61 | private static Interceptor onlineInterceptor() {
62 | return chain -> {
63 | Request request = chain.request();
64 | Response originalResponse = chain.proceed(request);
65 | String cacheControl = originalResponse.header("Cache-Control");
66 |
67 | if (cacheControl == null || cacheControl.contains("no-store") || cacheControl.contains("no-cache") ||
68 | cacheControl.contains("must-revalidate") || cacheControl.contains("max-stale=0")) {
69 |
70 | CacheControl cc = new CacheControl.Builder()
71 | .maxStale(1, TimeUnit.DAYS)
72 | .build();
73 |
74 | request = request.newBuilder()
75 | .cacheControl(cc)
76 | .build();
77 |
78 | return chain.proceed(request);
79 |
80 | } else {
81 | return originalResponse;
82 | }
83 | };
84 | }
85 |
86 | private static Interceptor offlineInterceptor() {
87 | return chain -> {
88 | try {
89 | return chain.proceed(chain.request());
90 | } catch (Exception e) {
91 | CacheControl cacheControl = new CacheControl.Builder()
92 | .onlyIfCached()
93 | .maxStale(1, TimeUnit.DAYS)
94 | .build();
95 |
96 | Request offlineRequest = chain.request().newBuilder()
97 | .cacheControl(cacheControl)
98 | .build();
99 | return chain.proceed(offlineRequest);
100 | }
101 | };
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/easyretro/src/main/java/com/manojbhadane/easyretro/MakeRequest.java:
--------------------------------------------------------------------------------
1 | package com.manojbhadane.easyretro;
2 |
3 | import android.util.Log;
4 |
5 | import org.json.JSONObject;
6 |
7 | import okhttp3.ResponseBody;
8 | import retrofit2.Call;
9 | import retrofit2.Callback;
10 | import retrofit2.Response;
11 |
12 | @SuppressWarnings("unchecked")
13 | public class MakeRequest {
14 |
15 | private static MakeRequest mInstance;
16 | private final String mErrorWentWrong = "Something went wrong";
17 |
18 | private MakeRequest() {
19 | }
20 |
21 | public static synchronized MakeRequest getInstance() {
22 | if (mInstance == null)
23 | mInstance = new MakeRequest();
24 | return mInstance;
25 | }
26 |
27 | public static void printLog(String log) {
28 | if (BuildConfig.DEBUG)
29 | Log.e("--", log);
30 | }
31 |
32 | /**
33 | * Returns model as response
34 | *
35 | * @param call
36 | * @param isInternet
37 | * @param listener
38 | * @param
39 | */
40 | public void request(Call call, boolean isInternet, final ResponseListener listener) {
41 | try {
42 | if (isInternet) {
43 | printLog("Request Url : " + call.request().url());
44 | //noinspection unchecked
45 | call.enqueue(new Callback() {
46 | @Override
47 | public void onResponse(Call call, Response response) {
48 | try {
49 | printLog("onResponse : isSuccessful : " + response.isSuccessful());
50 | if (response.isSuccessful()) {
51 | T model = (T) response.body();
52 | listener.onResponse(model, response);
53 | } else {
54 | listener.onError(mErrorWentWrong, response);
55 | }
56 | } catch (Exception e) {
57 | e.printStackTrace();
58 | listener.onError(mErrorWentWrong, null);
59 | }
60 | }
61 |
62 | @Override
63 | public void onFailure(Call call, Throwable t) {
64 | try {
65 | printLog("onFailure : Message : " + t.getMessage());
66 | printLog("onFailure : Cause : " + t.getCause());
67 | printLog("onFailure : StackTrace : " + t.getStackTrace());
68 | listener.onError(mErrorWentWrong, null);
69 | } catch (Exception e) {
70 | e.printStackTrace();
71 | listener.onError(mErrorWentWrong, null);
72 | }
73 | }
74 | });
75 | } else {
76 | listener.onError("No internet connection", null);
77 | }
78 | } catch (Exception e) {
79 | e.printStackTrace();
80 | listener.onError(mErrorWentWrong, null);
81 | }
82 | }
83 |
84 | /**
85 | * Returns String as response, later cast it to String
86 | *
87 | * @param call call
88 | * @param listener result callback
89 | */
90 | public void requestStringAsResponse(Call call, boolean isInternet, final ResponseListener listener) {
91 |
92 | try {
93 | if (isInternet) {
94 | printLog("Request Url : " + call.request().url());
95 |
96 | call.enqueue(new Callback() {
97 | @Override
98 | public void onResponse(Call call, Response response) {
99 |
100 | try {
101 | printLog("onResponse : isSuccessful : " + response.isSuccessful());
102 | if (response.isSuccessful()) {
103 | listener.onResponse(new JSONObject(response.body().string()), response);
104 | } else {
105 | listener.onError(mErrorWentWrong, response);
106 | }
107 | } catch (Exception e) {
108 | e.printStackTrace();
109 | listener.onError(mErrorWentWrong, null);
110 | }
111 | }
112 |
113 | @Override
114 | public void onFailure(Call call, Throwable t) {
115 | try {
116 | printLog("onFailure : Message : " + t.getMessage());
117 | printLog("onFailure : Cause : " + t.getCause());
118 | printLog("onFailure : StackTrace : " + t.getStackTrace());
119 | listener.onError(mErrorWentWrong, null);
120 | } catch (Exception e) {
121 | e.printStackTrace();
122 | listener.onError(mErrorWentWrong, null);
123 | }
124 | }
125 | });
126 | } else {
127 | listener.onError("No internet connection", null);
128 | }
129 | } catch (Exception e) {
130 | e.printStackTrace();
131 | listener.onError(mErrorWentWrong, null);
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # EasyRetro [](https://twitter.com/intent/tweet?url=https://github.com/manojbhadane/EasyRetro)
2 |
3 | An Easy to use retrofit based network/api call extention for android
4 |
5 | 1. No need to check internet connection before api call
6 | 2. Easy to use
7 | 3. Minimal configuration
8 | 4. More readble code
9 |
10 | ### Specs
11 |
12 | [](https://android-arsenal.com/api?level=16)
13 |
14 | [](https://paypal.me/manojbhadane)
15 |
16 |
17 | # Download
18 |
19 | This library is available in **jitPack** which is the default Maven repository used in Android Studio.
20 |
21 | ## Gradle
22 | **Step 1.** Add it in your root build.gradle at the end of repositories
23 | ```
24 | allprojects
25 | {
26 | repositories {
27 | ...
28 | maven { url 'https://jitpack.io' }
29 | }
30 | }
31 | ```
32 |
33 | **Step 2.** Add the dependency in your apps module build.gradle
34 | ```
35 | dependencies
36 | {
37 | implementation 'com.github.manojbhadane:EasyRetro:v2.1'
38 | }
39 | ```
40 |
41 | ### Versions
42 |
43 | | Version | Description |
44 | | --- | --- |
45 | | v2.1 | Library upgraded to latest gradle and retrofit version |
46 | | | Gradle : 7.1.3 |
47 | | | Retrofit : 2.9.0 |
48 | | | Retrofit : 2.9.0 |
49 |
50 | # Usage
51 |
52 | ## In Application class
53 |
54 | ```
55 | EasyRetro.init(getApplicationContext(),"BASE_URL");
56 | ```
57 |
58 | ## Interfaces
59 | ```
60 | public interface ApiService {
61 |
62 | @GET
63 | public Call test(@Url String url);
64 |
65 | }
66 | ```
67 |
68 | ## In Activity
69 | ```
70 | ApiService apiService = EasyRetro.setServices(ApiService.class);
71 |
72 | Call call = apiService.test("https://raw.githubusercontent.com/manojbhadane/Kotlin-LambdaExpression/master/sample.json");
73 |
74 | EasyRetro.request(call, new ResponseListener() {
75 | @Override
76 | public void onResponse(ResModel model, Response response) {
77 | Toast.makeText(MainActivity.this, model.getData().getName(), Toast.LENGTH_SHORT).show();
78 | }
79 |
80 | @Override
81 | public void onError(String msg, Response response) {
82 | Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
83 | }
84 | });
85 | ```
86 |
87 | # Bugs or Requests
88 |
89 | If you encounter any problems feel free to open an [issue](https://github.com/manojbhadane/EasyRetro/issues/new?assignees=&labels=&template=bug_report.md). If you feel the library is missing a feature, please raise a [ticket](https://github.com/manojbhadane/EasyRetro/issues/new?assignees=&labels=&template=feature_request.md) on GitHub and I'll look into it. Pull request are also welcome.
90 |
91 | ### Spread Some :heart:
92 | [](https://github.com/manojbhadane) [](https://twitter.com/Manoj_bhadane)
93 |
94 | # About The Author
95 |
96 | ### Manoj Bhadane
97 |
98 | Android & Backend Developer.
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | # If this library helps you in anyway, show your love :heart: by putting a :star: on this project :v:
107 |
108 | # License
109 |
110 | ```
111 | MIT License
112 |
113 | Copyright (c) 2019 Manoj Bhadane
114 |
115 | Permission is hereby granted, free of charge, to any person obtaining a copy
116 | of this software and associated documentation files (the "Software"), to deal
117 | in the Software without restriction, including without limitation the rights
118 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
119 | copies of the Software, and to permit persons to whom the Software is
120 | furnished to do so, subject to the following conditions:
121 |
122 | The above copyright notice and this permission notice shall be included in all
123 | copies or substantial portions of the Software.
124 |
125 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
126 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
127 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
128 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
129 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
130 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
131 | SOFTWARE.
132 | ```
133 |
134 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------