mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
With artist information fixed (#3232)
This commit is contained in:
parent
0f5422f19d
commit
cbd5ee1850
1 changed files with 16 additions and 2 deletions
|
|
@ -12,7 +12,6 @@ import org.wikipedia.dataclient.mwapi.MwQueryPage;
|
||||||
import org.wikipedia.gallery.ExtMetadata;
|
import org.wikipedia.gallery.ExtMetadata;
|
||||||
import org.wikipedia.gallery.ImageInfo;
|
import org.wikipedia.gallery.ImageInfo;
|
||||||
import org.wikipedia.page.PageTitle;
|
import org.wikipedia.page.PageTitle;
|
||||||
import org.wikipedia.util.StringUtil;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -160,7 +159,7 @@ public class Media implements Parcelable {
|
||||||
0,
|
0,
|
||||||
safeParseDate(metadata.dateTime()),
|
safeParseDate(metadata.dateTime()),
|
||||||
safeParseDate(metadata.dateTime()),
|
safeParseDate(metadata.dateTime()),
|
||||||
StringUtil.fromHtml(metadata.artist()).toString()
|
getArtist(metadata)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!StringUtils.isBlank(imageInfo.getThumbUrl())) {
|
if (!StringUtils.isBlank(imageInfo.getThumbUrl())) {
|
||||||
|
|
@ -186,6 +185,21 @@ public class Media implements Parcelable {
|
||||||
return media;
|
return media;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method extracts the Commons Username from the artist HTML information
|
||||||
|
* @param metadata
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String getArtist(ExtMetadata metadata) {
|
||||||
|
try {
|
||||||
|
String artistHtml = metadata.artist();
|
||||||
|
return artistHtml.substring(artistHtml.indexOf("title=\""), artistHtml.indexOf("\">"))
|
||||||
|
.replace("title=\"User:", "");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getThumbUrl() {
|
public String getThumbUrl() {
|
||||||
return thumbUrl;
|
return thumbUrl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue