Finished removing coupling between classes around the getInstance() method.

This commit is contained in:
Paul Hawke 2017-08-25 21:40:50 -05:00 committed by Paul Hawke
parent dbcbeed822
commit ed1ae98d8e
18 changed files with 154 additions and 125 deletions

View file

@ -79,7 +79,6 @@ public class CommonsApplication extends DaggerApplication {
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
private static CommonsApplication instance = null;
private MediaWikiApi api = null;
private LruCache<String, String> thumbnailUrlCache = new LruCache<>(1024);
private CacheController cacheData = null;
@ -87,21 +86,6 @@ public class CommonsApplication extends DaggerApplication {
private NearbyPlaces nearbyPlaces = null;
private CommonsApplicationComponent component;
/**
* This should not be called by ANY application code (other than the magic Android glue)
* Use CommonsApplication.getInstance() instead to get the singleton.
*/
public CommonsApplication() {
CommonsApplication.instance = this;
}
public static CommonsApplication getInstance() {
if (instance == null) {
instance = new CommonsApplication();
}
return instance;
}
public MediaWikiApi getMWApi() {
if (api == null) {
api = new ApacheHttpClientMediaWikiApi(API_URL);