mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
Use JSON APIs for explore (#2731)
* Use JSON APIs for explore * With tests * Use JSON APIs for explore * With tests * BugFix #2731 (#4) * Increased sdk version to 23 * with more robust tests * Fix crashes and other reported issues * Add javadocs * Use common method for search and categories * Add javadocs
This commit is contained in:
parent
c1a941eaae
commit
c45b945526
14 changed files with 468 additions and 318 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package fr.free.nrw.commons.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
@ -25,4 +26,24 @@ public class MediaDataExtractorUtil {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts a list of categories from | separated category string
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static List<String> extractCategoriesFromList(String source) {
|
||||
if (StringUtils.isNullOrWhiteSpace(source)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String[] cats = source.split("\\|");
|
||||
List<String> categories = new ArrayList<>();
|
||||
for (String category : cats) {
|
||||
if (!StringUtils.isNullOrWhiteSpace(category.trim())) {
|
||||
categories.add(category);
|
||||
}
|
||||
}
|
||||
return categories;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue