author | Zhiwei Yan <zhiwei.yan@amlogic.com> | 2017-12-06 04:06:43 (GMT) |
---|---|---|
committer | Zhiwei Yan <zhiwei.yan@amlogic.com> | 2017-12-06 12:58:00 (GMT) |
commit | 761fe54584a1068317ebf7aa62de5d35646f080d (patch) | |
tree | b0179b8cef066f2e83b60ca4f5b8270910bee3b4 | |
parent | 2e9a3c83b799bd84bf0c36b2ffb7a56512b838de (diff) | |
download | tv-761fe54584a1068317ebf7aa62de5d35646f080d.zip tv-761fe54584a1068317ebf7aa62de5d35646f080d.tar.gz tv-761fe54584a1068317ebf7aa62de5d35646f080d.tar.bz2 |
tv-framework: add region to judge rrt5 or not [3/4]
PD# 156149
add region to judge rrt5 or not
Change-Id: I324410cb04d0a848658fb05047278d0606dc29b8
-rw-r--r-- | core/java/com/droidlogic/app/tv/DroidContentRatingsParser.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/com/droidlogic/app/tv/DroidContentRatingsParser.java b/core/java/com/droidlogic/app/tv/DroidContentRatingsParser.java index d3051e0..50816d4 100644 --- a/core/java/com/droidlogic/app/tv/DroidContentRatingsParser.java +++ b/core/java/com/droidlogic/app/tv/DroidContentRatingsParser.java @@ -77,6 +77,7 @@ public class DroidContentRatingsParser { private static final boolean DEBUG = false; public static final String DOMAIN_RRT_RATINGS = "com.droidlogic.app.tv"; + public static final int FIXED_REGION_lEVEL_2 = 2; private static final String TAG_RATING_SYSTEM_DEFINITIONS = "rating-system-definitions"; private static final String TAG_RATING_SYSTEM_DEFINITION = "rating-system-definition"; @@ -170,6 +171,7 @@ public class DroidContentRatingsParser { break; case ATTR_RATING: //Log.w(TAG, " attr:"+attr+", value:"+parser.getAttributeValue(i)); + builder.setRegion(StringToInt(parser.getAttributeValue(i))); break; case ATTR_COUNTRY: // Log.w(TAG, " attr:"+attr+", value:"+parser.getAttributeValue(i)); @@ -192,6 +194,16 @@ public class DroidContentRatingsParser { return builder; } + private int StringToInt(String value) { + int getvalue = -1; + try { + getvalue = Integer.valueOf(value); + } catch (NumberFormatException e){ + throw new NumberFormatException("string is not integer: " + value); + } + return getvalue; + } + private RatingDefinition parseRatingDefinition_t(XmlPullParser parser) throws XmlPullParserException, IOException { RatingDefinition builder = new RatingDefinition(); @@ -227,6 +239,7 @@ public class DroidContentRatingsParser { public class ContentRatingSystemT { private String mName; private String mCountry; + private int mRegion; private final List<RatingDefinition> mRatings = new ArrayList<>(); public void ContentRatingSystemT(){ @@ -246,6 +259,14 @@ public class DroidContentRatingsParser { mCountry = country; } + public void setRegion(int region) { + mRegion = region; + } + + public int getRegion() { + return mRegion; + } + public String getName() { return mName; } |