mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Parse XML to fine out if fileExists
This commit is contained in:
parent
9721472c4c
commit
c34b8300c4
1 changed files with 5 additions and 10 deletions
|
|
@ -50,16 +50,11 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
|
|||
return false;
|
||||
}
|
||||
|
||||
ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/search/p/@title");
|
||||
for(ApiResult categoryNode: categoryNodes) {
|
||||
String cat = categoryNode.getDocument().getTextContent();
|
||||
String catString = cat.replace("Category:", "");
|
||||
items.add(catString);
|
||||
}
|
||||
//ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/search/p/@title");
|
||||
ArrayList<ApiResult> resultNodes = result.getNodes("/api/query/allimages/");
|
||||
boolean fileExists = !resultNodes.isEmpty();
|
||||
Log.d(TAG, "File already exists in Commons:" + fileExists);
|
||||
|
||||
Log.d(TAG, "Title cat query results: " + items);
|
||||
|
||||
return items;
|
||||
return fileExists;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue