diff --git a/app/build.gradle b/app/build.gradle index b000daf..18590f0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,4 +27,5 @@ dependencies { compile 'com.android.support:recyclerview-v7:21.0.3' compile 'com.googlecode.android-query:android-query:0.25.9' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' + compile 'org.apache.commons:commons-lang3:3.4' } diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/WikiUtils.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/WikiUtils.java index e5aeeb8..9c210a2 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/WikiUtils.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/utils/WikiUtils.java @@ -5,6 +5,7 @@ import android.util.Log; import com.androidquery.AQuery; import com.androidquery.callback.AjaxCallback; import com.androidquery.callback.AjaxStatus; +import org.apache.commons.lang3.StringUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -216,7 +217,8 @@ public class WikiUtils { final Double latitude, final Double longitude, final Double radius, - final Long limit) { + final Long limit, + final WikiResponseCallback callback) { fetchGeoSearchWikiMetadata(ctx, latitude, longitude, radius, limit, new WikiGeoResponseCallback() { @Override @@ -231,14 +233,11 @@ public class WikiUtils { pageIds.add(wikiGeoObject.getPageId()); } + WikiResponseCallback tcallback = callback; + fetchPageInfos(ctx, pageIds, - new WikiResponseCallback() { - @Override - public void callback(WikiStatus status, WikiResponse response) { - - } - }); + tcallback); } }); @@ -246,7 +245,15 @@ public class WikiUtils { public static void fetchPageInfos(Context ctx, List pageIds, final WikiResponseCallback callback) { AQuery aq = new AQuery(ctx); - aq.ajax("FILL_URL_TO_FIND_DATA_BY_PAGEIDS", JSONObject.class, new AjaxCallback() { + aq.ajax("https://en.wikipedia.org/w/api.php" + + "?action=query" + + "&prop=coordinates%7Cpageimages%7Cpageterms" + + "&colimit=50" + + "&piprop=thumbnail" + + "&pithumbsize=144" + + "&pilimit=50" + + "&wbptterms=description" + + "&pageids=" + StringUtils.join(pageIds, "|"), JSONObject.class, new AjaxCallback() { @Override public void callback(String url, JSONObject object, AjaxStatus status) { if (status.getCode() != 200) {