mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Fetch and use thumbnail across the app (#2906)
This commit is contained in:
parent
17d69cde02
commit
37e9eae314
18 changed files with 161 additions and 260 deletions
|
|
@ -52,7 +52,6 @@ import timber.log.Timber;
|
|||
* @author Addshore
|
||||
*/
|
||||
public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
||||
private static final String THUMB_SIZE = "640";
|
||||
private AbstractHttpClient httpClient;
|
||||
private CustomMwApi api;
|
||||
private CustomMwApi wikidataApi;
|
||||
|
|
@ -293,18 +292,6 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
.getString("/api/edit/@result");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> findThumbnailByFilename(String filename) {
|
||||
return Single.fromCallable(() -> api.action("query")
|
||||
.param("format", "xml")
|
||||
.param("prop", "imageinfo")
|
||||
.param("iiprop", "url")
|
||||
.param("iiurlwidth", THUMB_SIZE)
|
||||
.param("titles", filename)
|
||||
.get()
|
||||
.getString("/api/query/pages/page/imageinfo/ii/@thumburl"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> parseWikicode(String source) {
|
||||
return Single.fromCallable(() -> api.action("flow-parsoid-utils")
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ public interface MediaWikiApi {
|
|||
|
||||
Single<Boolean> pageExists(String pageName);
|
||||
|
||||
Single<String> findThumbnailByFilename(String filename);
|
||||
|
||||
List<String> getSubCategoryList(String categoryName);
|
||||
|
||||
List<String> getParentCategoryList(String categoryName);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import timber.log.Timber;
|
|||
*/
|
||||
@Singleton
|
||||
public class OkHttpJsonApiClient {
|
||||
private static final String THUMB_SIZE = "640";
|
||||
|
||||
public static final Type mapType = new TypeToken<Map<String, String>>() {
|
||||
}.getType();
|
||||
|
|
@ -274,6 +275,7 @@ public class OkHttpJsonApiClient {
|
|||
private HttpUrl.Builder appendMediaProperties(HttpUrl.Builder builder) {
|
||||
builder.addQueryParameter("prop", "imageinfo")
|
||||
.addQueryParameter("iiprop", "url|extmetadata")
|
||||
.addQueryParameter("iiurlwidth", THUMB_SIZE)
|
||||
.addQueryParameter("iiextmetadatafilter", "DateTime|Categories|GPSLatitude|GPSLongitude|ImageDescription|DateTimeOriginal|Artist|LicenseShortName|LicenseUrl");
|
||||
|
||||
String language = Locale.getDefault().getLanguage();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue