aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tv/data/GenreItems.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/tv/data/GenreItems.java')
-rw-r--r--src/com/android/tv/data/GenreItems.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/com/android/tv/data/GenreItems.java b/src/com/android/tv/data/GenreItems.java
index 92e38809..b1110612 100644
--- a/src/com/android/tv/data/GenreItems.java
+++ b/src/com/android/tv/data/GenreItems.java
@@ -17,13 +17,11 @@
package com.android.tv.data;
import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
import android.content.Context;
import android.media.tv.TvContract.Programs.Genres;
import android.os.Build;
import com.android.tv.R;
-import com.android.tv.common.CollectionUtils;
public class GenreItems {
/**
@@ -31,7 +29,7 @@ public class GenreItems {
*/
public static final int ID_ALL_CHANNELS = 0;
- private static final String[] CANONICAL_GENRES_BASE = {
+ private static final String[] CANONICAL_GENRES_L = {
null, // All channels
Genres.FAMILY_KIDS,
Genres.SPORTS,
@@ -47,23 +45,34 @@ public class GenreItems {
};
@SuppressLint("InlinedApi")
- private static final String[] CANONICAL_GENRES_ADDED_IN_L_MR1 = {
- Genres.ARTS,
- Genres.ENTERTAINMENT,
- Genres.LIFE_STYLE,
- Genres.MUSIC,
- Genres.PREMIER,
- Genres.TECH_SCIENCE
+ private static final String[] CANONICAL_GENRES_L_MR1 = {
+ null, // All channels
+ Genres.FAMILY_KIDS,
+ Genres.SPORTS,
+ Genres.SHOPPING,
+ Genres.MOVIES,
+ Genres.COMEDY,
+ Genres.TRAVEL,
+ Genres.DRAMA,
+ Genres.EDUCATION,
+ Genres.ANIMAL_WILDLIFE,
+ Genres.NEWS,
+ Genres.GAMING,
+ Genres.ARTS,
+ Genres.ENTERTAINMENT,
+ Genres.LIFE_STYLE,
+ Genres.MUSIC,
+ Genres.PREMIER,
+ Genres.TECH_SCIENCE
};
private static final String[] CANONICAL_GENRES = createGenres();
private static String[] createGenres() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
- return CANONICAL_GENRES_BASE;
+ return CANONICAL_GENRES_L;
} else {
- return CollectionUtils
- .concatAll(CANONICAL_GENRES_BASE, CANONICAL_GENRES_ADDED_IN_L_MR1);
+ return CANONICAL_GENRES_L_MR1;
}
}
@@ -73,7 +82,9 @@ public class GenreItems {
* Returns array of all genre labels.
*/
public static String[] getLabels(Context context) {
- String[] items = context.getResources().getStringArray(R.array.genre_labels);
+ String[] items = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1
+ ? context.getResources().getStringArray(R.array.genre_labels_l)
+ : context.getResources().getStringArray(R.array.genre_labels_l_mr1);
if (items.length != CANONICAL_GENRES.length) {
throw new IllegalArgumentException("Genre data mismatch");
}