mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-03 16:23:54 +01:00
Moved other singletons over to being managed by Dagger
This commit is contained in:
parent
647cc166ef
commit
cfe17cafa6
9 changed files with 69 additions and 74 deletions
|
|
@ -31,7 +31,6 @@ import javax.inject.Inject;
|
|||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.location.LatLng;
|
||||
import fr.free.nrw.commons.location.LocationServiceManager;
|
||||
|
|
@ -43,7 +42,7 @@ public class NearbyActivity extends NavigationBaseActivity {
|
|||
|
||||
@BindView(R.id.progressBar)
|
||||
ProgressBar progressBar;
|
||||
@Inject CommonsApplication application;
|
||||
@Inject NearbyPlaces nearbyPlaces;
|
||||
|
||||
private boolean isMapViewActive = false;
|
||||
private static final int LOCATION_REQUEST = 1;
|
||||
|
|
@ -94,7 +93,7 @@ public class NearbyActivity extends NavigationBaseActivity {
|
|||
locationManager = new LocationServiceManager(this);
|
||||
locationManager.registerLocationManager();
|
||||
curLatLang = locationManager.getLatestLocation();
|
||||
nearbyAsyncTask = new NearbyAsyncTask(this, new NearbyController(application));
|
||||
nearbyAsyncTask = new NearbyAsyncTask(this, new NearbyController(nearbyPlaces));
|
||||
nearbyAsyncTask.execute();
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +232,7 @@ public class NearbyActivity extends NavigationBaseActivity {
|
|||
}
|
||||
|
||||
private void refreshView() {
|
||||
nearbyAsyncTask = new NearbyAsyncTask(this, new NearbyController(application));
|
||||
nearbyAsyncTask = new NearbyAsyncTask(this, new NearbyController(nearbyPlaces));
|
||||
nearbyAsyncTask.execute();
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +261,7 @@ public class NearbyActivity extends NavigationBaseActivity {
|
|||
|
||||
@Override
|
||||
protected List<Place> doInBackground(Void... params) {
|
||||
return nearbyController.loadAttractionsFromLocation(curLatLang, application);
|
||||
return nearbyController.loadAttractionsFromLocation(curLatLang, NearbyActivity.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.location.LatLng;
|
||||
import fr.free.nrw.commons.utils.UiUtils;
|
||||
|
|
@ -27,11 +26,10 @@ import static fr.free.nrw.commons.utils.LengthUtils.formatDistanceBetween;
|
|||
|
||||
public class NearbyController {
|
||||
private static final int MAX_RESULTS = 1000;
|
||||
private final NearbyPlaces nearbyPlaces;
|
||||
|
||||
private final CommonsApplication application;
|
||||
|
||||
public NearbyController(CommonsApplication application) {
|
||||
this.application = application;
|
||||
public NearbyController(NearbyPlaces nearbyPlaces) {
|
||||
this.nearbyPlaces = nearbyPlaces;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +43,6 @@ public class NearbyController {
|
|||
if (curLatLng == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
NearbyPlaces nearbyPlaces = application.getNearbyPlaces();
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
List<Place> places = prefs.getBoolean("useWikidata", true)
|
||||
? nearbyPlaces.getFromWikidataQuery(curLatLng, Locale.getDefault().getLanguage())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue