Java Code Examples for android.media.tv.TvContentRating#unflattenFromString()

The following examples show how to use android.media.tv.TvContentRating#unflattenFromString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlTvParser.java    From xipl with Apache License 2.0 5 votes vote down vote up
/**
 * Converts a TV ratings from an XML file to {@link TvContentRating}.
 *
 * @param rating An XmlTvRating.
 * @return A TvContentRating.
 */
private static TvContentRating xmlTvRatingToTvContentRating(XmlTvParser.XmlTvRating rating) {
    if (ANDROID_TV_RATING.equals(rating.system)) {
        return TvContentRating.unflattenFromString(rating.value);
    }
    return null;
}
 
Example 2
Source File: TvContractUtils.java    From xipl with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a string of comma-separated ratings into an array of {@link TvContentRating}.
 *
 * @param commaSeparatedRatings String containing various ratings, separated by commas.
 * @return An array of TvContentRatings.
 * @hide
 */
public static TvContentRating[] stringToContentRatings(String commaSeparatedRatings) {
    if (TextUtils.isEmpty(commaSeparatedRatings)) {
        return null;
    }
    String[] ratings = commaSeparatedRatings.split("\\s*,\\s*");
    TvContentRating[] contentRatings = new TvContentRating[ratings.length];
    for (int i = 0; i < contentRatings.length; ++i) {
        contentRatings[i] = TvContentRating.unflattenFromString(ratings[i]);
    }
    return contentRatings;
}
 
Example 3
Source File: TvContractUtils.java    From ChannelSurfer with MIT License 5 votes vote down vote up
public static TvContentRating[] stringToContentRatings(String commaSeparatedRatings) {
    if (TextUtils.isEmpty(commaSeparatedRatings)) {
        return null;
    }
    String[] ratings = commaSeparatedRatings.split("\\s*,\\s*");
    TvContentRating[] contentRatings = new TvContentRating[ratings.length];
    for (int i = 0; i < contentRatings.length; ++i) {
        contentRatings[i] = TvContentRating.unflattenFromString(ratings[i]);
    }
    return contentRatings;
}
 
Example 4
Source File: CumulusXmlParser.java    From CumulusTV with MIT License 5 votes vote down vote up
/**
 * Converts a TV ratings from an XML file to {@link TvContentRating}.
 *
 * @param rating An XmlTvRating.
 * @return A TvContentRating.
 */
private static TvContentRating xmlTvRatingToTvContentRating(
        CumulusXmlParser.XmlTvRating rating) {
    if (ANDROID_TV_RATING.equals(rating.system)) {
        return TvContentRating.unflattenFromString(rating.value);
    }
    return null;
}
 
Example 5
Source File: XmlTvParser.java    From androidtv-sample-inputs with Apache License 2.0 5 votes vote down vote up
/**
 * Converts a TV ratings from an XML file to {@link TvContentRating}.
 *
 * @param rating An XmlTvRating.
 * @return A TvContentRating.
 */
private static TvContentRating xmlTvRatingToTvContentRating(XmlTvParser.XmlTvRating rating) {
    if (ANDROID_TV_RATING.equals(rating.system)) {
        return TvContentRating.unflattenFromString(rating.value);
    }
    return null;
}
 
Example 6
Source File: TvContractUtils.java    From androidtv-sample-inputs with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a string of comma-separated ratings into an array of {@link TvContentRating}.
 *
 * @param commaSeparatedRatings String containing various ratings, separated by commas.
 * @return An array of TvContentRatings.
 * @hide
 */
public static TvContentRating[] stringToContentRatings(String commaSeparatedRatings) {
    if (TextUtils.isEmpty(commaSeparatedRatings)) {
        return null;
    }
    String[] ratings = commaSeparatedRatings.split("\\s*,\\s*");
    TvContentRating[] contentRatings = new TvContentRating[ratings.length];
    for (int i = 0; i < contentRatings.length; ++i) {
        contentRatings[i] = TvContentRating.unflattenFromString(ratings[i]);
    }
    return contentRatings;
}