Get rid of other singletons

This commit is contained in:
addshore 2017-05-16 11:22:17 +02:00
parent bdfbdc7579
commit c712b561d4
7 changed files with 31 additions and 31 deletions

View file

@ -30,6 +30,7 @@ import fr.free.nrw.commons.contributions.Contribution;
import fr.free.nrw.commons.data.DBOpenHelper;
import fr.free.nrw.commons.modifications.ModifierSequence;
import fr.free.nrw.commons.auth.AccountUtil;
import fr.free.nrw.commons.nearby.NearbyPlaces;
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
@ -85,6 +86,8 @@ public class CommonsApplication extends Application {
private MWApi api = null;
private CacheController cacheData = null;
private RequestQueue volleyQueue = null;
private DBOpenHelper dbOpenHelper = null;
private NearbyPlaces nearbyPlaces = null;
/**
* This should not be called by ANY application code (other than the magic Android glue)
@ -146,6 +149,20 @@ public class CommonsApplication extends Application {
return volleyQueue;
}
public synchronized DBOpenHelper getDBOpenHelper() {
if(dbOpenHelper == null) {
dbOpenHelper = new DBOpenHelper(this);
}
return dbOpenHelper;
}
public synchronized NearbyPlaces getNearbyPlaces() {
if (nearbyPlaces == null) {
nearbyPlaces = new NearbyPlaces();
}
return nearbyPlaces;
}
@Override
public void onCreate() {
super.onCreate();