mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
* Extracted out PageTitle object's member varaible, displayText in a variable in findTemplate() in MediaDataExtractor * added null checks for the same varaible [Lets be safe side] * replaced equals with contains, ie. displayText.contains(title), so that uploads from multiple sources which have different formats still show up coordinates which was not being shown earlier
This commit is contained in:
parent
4ea7229876
commit
e4584217d2
1 changed files with 6 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package fr.free.nrw.commons;
|
|||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
|
@ -161,7 +162,11 @@ public class MediaDataExtractor {
|
|||
Node node = nodes.item(i);
|
||||
if (node.getNodeName().equals("template")) {
|
||||
String foundTitle = getTemplateTitle(node);
|
||||
if (title.equals(new PageTitle(foundTitle).getDisplayText())) {
|
||||
String displayText = new PageTitle(foundTitle).getDisplayText();
|
||||
//replaced equals with contains because multiple sources had multiple formats
|
||||
//say from two sources I had {{Location|12.958117388888889|77.6440805}} & {{Location dec|47.99081|7.845416|heading:255.9}},
|
||||
//So exact string match would show null results for uploads via web
|
||||
if (!(TextUtils.isEmpty(displayText)) && displayText.contains(title)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue