-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TheCatAPIService to the App lifetime
- Loading branch information
1 parent
e39ee8c
commit a8180a9
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.catter2; | ||
|
||
import android.app.Application; | ||
|
||
import io.catter2.cat_api.CacheTheCatAPI; | ||
import io.catter2.cat_api.RetrofitTheCatAPI; | ||
import io.catter2.cat_api.TheCatAPI; | ||
|
||
public class App extends Application { | ||
private static TheCatAPI theCatAPI; | ||
|
||
public static TheCatAPI getTheCatAPIService() { | ||
return App.theCatAPI; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
TheCatAPI theCatAPIService = new RetrofitTheCatAPI(); | ||
TheCatAPI theCatAPICache = new CacheTheCatAPI(theCatAPIService); | ||
App.theCatAPI = theCatAPICache; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters