mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Clean up image loading code, and switch to using Fresco.
This commit is contained in:
parent
1a1fc143c9
commit
bb49fb9801
7 changed files with 68 additions and 254 deletions
|
|
@ -0,0 +1,27 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import org.mediawiki.api.ApiResult;
|
||||
|
||||
class MediaThumbnailFetchTask extends AsyncTask<String, String, String> {
|
||||
private static final String THUMB_SIZE = "640";
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... params) {
|
||||
try {
|
||||
MWApi api = CommonsApplication.app.getApi();
|
||||
ApiResult result =api.action("query")
|
||||
.param("format", "xml")
|
||||
.param("prop", "imageinfo")
|
||||
.param("iiprop", "url")
|
||||
.param("iiurlwidth", THUMB_SIZE)
|
||||
.param("titles", params[0])
|
||||
.get();
|
||||
return result.getString("/api/query/pages/page/imageinfo/ii/@thumburl");
|
||||
} catch (Exception e) {
|
||||
// Do something better!
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue