Merge "TIF: optimize android.media.tv.Tvcontract.Programs.Genres#decode" into nyc-dev
am: 079cf52336
* commit '079cf523365e4018d1a439e1a32bb30d79c069c3':
TIF: optimize android.media.tv.Tvcontract.Programs.Genres#decode
This commit is contained in:
@@ -1314,6 +1314,8 @@ public final class TvContract {
|
|||||||
private static final char COMMA = ',';
|
private static final char COMMA = ',';
|
||||||
private static final String DELIMITER = ",";
|
private static final String DELIMITER = ",";
|
||||||
|
|
||||||
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
|
|
||||||
private Genres() {}
|
private Genres() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1359,6 +1361,12 @@ public final class TvContract {
|
|||||||
* @return genre strings.
|
* @return genre strings.
|
||||||
*/
|
*/
|
||||||
public static String[] decode(String genres) {
|
public static String[] decode(String genres) {
|
||||||
|
if (genres.isEmpty()) {
|
||||||
|
return EMPTY_STRING_ARRAY;
|
||||||
|
}
|
||||||
|
if (genres.indexOf(COMMA) == -1 && genres.indexOf(DOUBLE_QUOTE) == -1) {
|
||||||
|
return new String[] {genres.trim()};
|
||||||
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
List<String> results = new ArrayList<>();
|
List<String> results = new ArrayList<>();
|
||||||
int length = genres.length();
|
int length = genres.length();
|
||||||
|
|||||||
Reference in New Issue
Block a user