Skip to content

Commit d14bb58

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents e9dc7d7 + e24a2fe commit d14bb58

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ dependencies {
6969
* extend your activities with BaseActivity
7070
* extent your fragments with BaseFragment
7171

72-
And your good to go...
72+
And you're good to go...
7373

7474
## To Use retrofit http client
7575

@@ -78,17 +78,34 @@ inside ```onCreate();``` on Application Class
7878

7979
```BaseApp.setBaseUrl("https://example.com/apis/");```
8080

81-
##### 2- Create ApiRequester Class
82-
find example class here [ApiRequester](https://github.com/devloopsnet/Base/blob/master/app/src/main/java/com/devloops/activities/http/ApiRequester.java)
81+
##### 2- Create ApiMethods Interface
82+
* include retrofit dependencies in your build.gradle file
83+
```
84+
dependencies {
85+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
86+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
87+
}
88+
```
89+
* create inner interface for your api paths.
90+
* define routes like you normally do with retrofit with your desired model.
8391

84-
##### 3- Create ApiMethods Class
85-
find example class here [ApiMethods](https://github.com/devloopsnet/Base/blob/master/app/src/main/java/com/devloops/activities/http/ApiMethods.java)
92+
find example here [ApiMethods](https://github.com/devloopsnet/Base/blob/master/app/src/main/java/com/devloops/activities/http/ApiMethods.java)
8693

87-
##### 4- Create instance of ApiRequester
94+
##### 4- Create ApiRequester Class
95+
* create varialbles for Context and ApiMethods.
96+
* create constructor to initialize context and ApiMethods.
97+
* Create a getInstance mehtod to get ApiRequester instance.
98+
* call your api's using ApiMethods instance.
99+
* create your own ApiCallback interface.
100+
101+
find example class here [ApiRequester](https://github.com/devloopsnet/Base/blob/master/app/src/main/java/com/devloops/activities/http/ApiRequester.java)
102+
103+
##### 4- Create instance of ApiRequester in your activity or fragment.
88104
```
89105
requester = ApiRequester.getInstance(context);
90106
```
91-
Then call your api..
107+
Then call your api with the api's you defined in your ApiRequester class.
108+
92109
```
93110
requester.getTestRequest(new ApiRequester.ApiCallback() {
94111
@Override
@@ -149,4 +166,4 @@ Volley client support 4 methods
149166

150167
* Hat tip to anyone whose code was used
151168
* Inspiration
152-
* etc
169+
* etc

0 commit comments

Comments
 (0)