Skip to content

Commit bb5a669

Browse files
committed
Don't pass Activity into MwVolleyApi.
1 parent b07432f commit bb5a669

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

app/src/main/java/fr/free/nrw/commons/upload/MwVolleyApi.java

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package fr.free.nrw.commons.upload;
22

3-
import android.content.Context;
43
import android.net.Uri;
54

65
import com.android.volley.Cache;
@@ -21,6 +20,7 @@
2120
import java.util.List;
2221
import java.util.Set;
2322

23+
import fr.free.nrw.commons.CommonsApplication;
2424
import timber.log.Timber;
2525

2626
/**
@@ -32,15 +32,13 @@ public class MwVolleyApi {
3232

3333
private static RequestQueue REQUEST_QUEUE;
3434
private static final Gson GSON = new GsonBuilder().create();
35-
private Context context;
3635

3736
protected static Set<String> categorySet;
3837
private static List<String> categoryList;
3938

4039
private static final String MWURL = "https://commons.wikimedia.org/";
4140

42-
public MwVolleyApi(Context context) {
43-
this.context = context;
41+
public MwVolleyApi() {
4442
categorySet = new HashSet<>();
4543
}
4644

@@ -94,12 +92,8 @@ private String buildUrl (String coords){
9492
}
9593

9694
private synchronized RequestQueue getQueue() {
97-
return getQueue(context);
98-
}
99-
100-
private static RequestQueue getQueue(Context context) {
10195
if (REQUEST_QUEUE == null) {
102-
REQUEST_QUEUE = Volley.newRequestQueue(context);
96+
REQUEST_QUEUE = Volley.newRequestQueue(CommonsApplication.getInstance());
10397
}
10498
return REQUEST_QUEUE;
10599
}

app/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public void useImageCoords() {
402402
app.getCacheData().setQtPoint(decLongitude, decLatitude);
403403
}
404404

405-
MwVolleyApi apiCall = new MwVolleyApi(this);
405+
MwVolleyApi apiCall = new MwVolleyApi();
406406

407407
List<String> displayCatList = app.getCacheData().findCategory();
408408
boolean catListEmpty = displayCatList.isEmpty();

0 commit comments

Comments
 (0)