类android.media.Rating源码实例Demo

下面列出了怎么用android.media.Rating的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: leanback-assistant   文件: MockDatabase.java
private static Movie elephantsDream() {
    MovieBuilder builder = new MovieBuilder();
    builder.setId(1)
            .setTitle("Elephant's Dream")
            .setDescription(
                    "The story of two strange characters exploring a capricious and seemingly infinite machine. The elder, Proog, acts as a tour-guide and protector, happily showing off the sights and dangers of the machine to his initially curious but increasingly skeptical protege Emo. As their journey unfolds we discover signs that the machine is not all Proog thinks it is, and his guiding takes on a more desperate aspect.")
            .setCardImage(
                    "https://orange.blender.org/wp-content/themes/orange/images/common/ed_header.jpg?x53801")
            .setBackgroundImage(
                    "https://orange.blender.org/wp-content/themes/orange/images/common/ed_header.jpg?x53801")
            .setVideoUrl("https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4")
            .setContentType("video/mp4")
            .setWidth(1280)
            .setHeight(720)
            .setAudioChannelConfig("2.0")
            .setPurchasePrice("$8.99")
            .setRentalPrice("$1.99")
            .setRatingStyle(Rating.RATING_5_STARS)
            .setRatingScore(3.5f)
            .setProductionYear(2006)
            .setDuration((int) (TimeUnit.MINUTES.toMillis(10) + TimeUnit.SECONDS.toMillis(53)));
    return builder.createMovie();
}
 
源代码2 项目: leanback-assistant   文件: MockDatabase.java
private static Movie bigBuckBunny() {
    MovieBuilder builder = new MovieBuilder();
    builder.setId(2)
            .setTitle("Big Buck Bunny")
            .setDescription(
                    "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.")
            .setCardImage(
                    "https://peach.blender.org/wp-content/uploads/poster_bunny_big.jpg?x11217")
            .setBackgroundImage(
                    "https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217")
            .setVideoUrl(
                    "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4")
            .setContentType("video/mp4")
            .setWidth(1280)
            .setHeight(720)
            .setAudioChannelConfig("2.0")
            .setPurchasePrice("$12.99")
            .setRentalPrice("$1.99")
            .setRatingStyle(Rating.RATING_5_STARS)
            .setRatingScore(2.75f)
            .setProductionYear(2008)
            .setDuration((int) (TimeUnit.MINUTES.toMillis(9) + TimeUnit.SECONDS.toMillis(56)));
    return builder.createMovie();
}
 
源代码3 项目: BuildingForAndroidTV   文件: VideoDatabase.java
/**
 * Add a movie to the database.
 *
 * @return rowId or -1 if failed
 */
public long addMovie(Movie movie) {
    ContentValues initialValues = new ContentValues();
    initialValues.put(KEY_NAME, movie.getTitle());
    initialValues.put(KEY_DESCRIPTION, movie.getDescription());
    initialValues.put(KEY_ICON, movie.getCardImageUrl());
    initialValues.put(KEY_DATA_TYPE, "video/mp4");
    initialValues.put(KEY_IS_LIVE, false);
    initialValues.put(KEY_VIDEO_WIDTH, CARD_WIDTH);
    initialValues.put(KEY_VIDEO_HEIGHT, CARD_HEIGHT);
    initialValues.put(KEY_AUDIO_CHANNEL_CONFIG, "2.0");
    initialValues.put(KEY_PURCHASE_PRICE, mHelperContext.getString(R.string.buy_2));
    initialValues.put(KEY_RENTAL_PRICE, mHelperContext.getString(R.string.rent_2));
    initialValues.put(KEY_RATING_STYLE, Rating.RATING_5_STARS);
    initialValues.put(KEY_RATING_SCORE, 3.5f);
    initialValues.put(KEY_PRODUCTION_YEAR, 2014);
    initialValues.put(KEY_COLUMN_DURATION, 0);
    initialValues.put(KEY_ACTION, mHelperContext.getString(R.string.global_search));
    return mDatabase.insert(FTS_VIRTUAL_TABLE, null, initialValues);
}
 
源代码4 项目: BuildingForAndroidTV   文件: VideoDatabase.java
/**
 * Add an entry to the database for dummy deep link.
 *
 * @return rowId or -1 if failed
 */
public long addMovieForDeepLink(String title, String description, int icon, long duration, String production_year) {
    ContentValues initialValues = new ContentValues();
    initialValues.put(KEY_NAME, title);
    initialValues.put(KEY_DESCRIPTION, description);
    initialValues.put(KEY_ICON, icon);
    initialValues.put(KEY_DATA_TYPE, "video/mp4");
    initialValues.put(KEY_IS_LIVE, false);
    initialValues.put(KEY_VIDEO_WIDTH, 1280);
    initialValues.put(KEY_VIDEO_HEIGHT, 720);
    initialValues.put(KEY_AUDIO_CHANNEL_CONFIG, "2.0");
    initialValues.put(KEY_PURCHASE_PRICE, "Free");
    initialValues.put(KEY_RENTAL_PRICE, "Free");
    initialValues.put(KEY_RATING_STYLE, Rating.RATING_5_STARS);
    initialValues.put(KEY_RATING_SCORE, 3.5f);
    initialValues.put(KEY_PRODUCTION_YEAR, production_year);
    initialValues.put(KEY_COLUMN_DURATION, duration);
    return mDatabase.insert(FTS_VIRTUAL_TABLE, null, initialValues);
}
 
源代码5 项目: android_9.0.0_r45   文件: MediaSessionRecord.java
public void rate(String packageName, int pid, int uid, ISessionControllerCallback caller,
        Rating rating) {
    try {
        mCb.onRate(packageName, pid, uid, caller, rating);
    } catch (RemoteException e) {
        Slog.e(TAG, "Remote failure in rate.", e);
    }
}
 
源代码6 项目: leanback-assistant   文件: MockDatabase.java
private static Movie jurassicPark() {
    MovieBuilder builder = new MovieBuilder();
    builder.setId(3)
            .setTitle("Jurassic Park")
            .setDescription(
                    "During a preview tour, a theme park suffers a major power breakdown that allows its cloned dinosaur exhibits to run amok.")
            .setCardImage(
                    "https://orange.blender.org/wp-content/themes/orange/images/common/ed_header.jpg?x53801")
            .setBackgroundImage(
                    "https://ackorange.blender.org/wp-content/themes/orange/images/common/ed_header.jpg?x53801")
            .setVideoUrl("https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4")
            .setContentType("video/mp4")
            .setWidth(1280)
            .setHeight(720)
            .setAudioChannelConfig("2.0")
            .setPurchasePrice("$19.99")
            .setRentalPrice("$9.99")
            .setRatingStyle(Rating.RATING_5_STARS)
            .setRatingScore(4.05f)
            .setProductionYear(1993)
            .setDuration(
                    (int)
                            (TimeUnit.HOURS.toMillis(2)
                                    + TimeUnit.MINUTES.toMillis(7)
                                    + TimeUnit.SECONDS.toMillis(15)));
    return builder.createMovie();
}
 
源代码7 项目: leanback-assistant   文件: MockDatabase.java
private static Movie theIncredibles() {
    MovieBuilder builder = new MovieBuilder();
    builder.setId(4)
            .setTitle("The Incredibles")
            .setDescription(
                    "In this lauded Pixar animated film, married superheroes Mr. Incredible (Craig T. Nelson) and Elastigirl (Holly Hunter) are forced to assume mundane lives as Bob and Helen Parr after all super-powered activities have been banned by the government. While Mr. Incredible loves his wife and kids, he longs to return to a life of adventure, and he gets a chance when summoned to an island to battle an out-of-control robot. Soon, Mr. Incredible is in trouble, and it's up to his family to save him.")
            .setCardImage(
                    "https://peach.blender.org/wp-content/uploads/poster_bunny_big.jpg?x11217")
            .setBackgroundImage(
                    "https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217")
            .setVideoUrl(
                    "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4")
            .setContentType("video/mp4")
            .setWidth(1280)
            .setHeight(720)
            .setAudioChannelConfig("2.0")
            .setPurchasePrice("$5.99")
            .setRentalPrice("$4.99")
            .setRatingStyle(Rating.RATING_5_STARS)
            .setRatingScore(4f)
            .setProductionYear(2004)
            .setDuration(
                    (int)
                            (TimeUnit.HOURS.toMillis(1)
                                    + TimeUnit.MINUTES.toMillis(56)
                                    + TimeUnit.SECONDS.toMillis(21)));
    return builder.createMovie();
}
 
源代码8 项目: android_9.0.0_r45   文件: MediaSessionRecord.java
@Override
public void rate(String packageName, ISessionControllerCallback caller, Rating rating) {
    mSessionCb.rate(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller,
            rating);
}
 
源代码9 项目: tv-samples   文件: VideoDbBuilder.java
/**
 * Takes the contents of a JSON object and populates the database
 * @param jsonObj The JSON object of videos
 * @throws JSONException if the JSON object is invalid
 */
public List<ContentValues> buildMedia(JSONObject jsonObj) throws JSONException {

    JSONArray categoryArray = jsonObj.getJSONArray(TAG_GOOGLE_VIDEOS);
    List<ContentValues> videosToInsert = new ArrayList<>();

    for (int i = 0; i < categoryArray.length(); i++) {
        JSONArray videoArray;

        JSONObject category = categoryArray.getJSONObject(i);
        String categoryName = category.getString(TAG_CATEGORY);
        videoArray = category.getJSONArray(TAG_MEDIA);

        for (int j = 0; j < videoArray.length(); j++) {
            JSONObject video = videoArray.getJSONObject(j);

            // If there are no URLs, skip this video entry.
            JSONArray urls = video.optJSONArray(TAG_SOURCES);
            if (urls == null || urls.length() == 0) {
                continue;
            }

            String title = video.optString(TAG_TITLE);
            String description = video.optString(TAG_DESCRIPTION);
            String videoUrl = (String) urls.get(0); // Get the first video only.
            String bgImageUrl = video.optString(TAG_BACKGROUND);
            String cardImageUrl = video.optString(TAG_CARD_THUMB);
            String studio = video.optString(TAG_STUDIO);

            ContentValues videoValues = new ContentValues();
            videoValues.put(VideoContract.VideoEntry.COLUMN_CATEGORY, categoryName);
            videoValues.put(VideoContract.VideoEntry.COLUMN_NAME, title);
            videoValues.put(VideoContract.VideoEntry.COLUMN_DESC, description);
            videoValues.put(VideoContract.VideoEntry.COLUMN_VIDEO_URL, videoUrl);
            videoValues.put(VideoContract.VideoEntry.COLUMN_CARD_IMG, cardImageUrl);
            videoValues.put(VideoContract.VideoEntry.COLUMN_BG_IMAGE_URL, bgImageUrl);
            videoValues.put(VideoContract.VideoEntry.COLUMN_STUDIO, studio);

            // Fixed defaults.
            videoValues.put(VideoContract.VideoEntry.COLUMN_CONTENT_TYPE, "video/mp4");
            videoValues.put(VideoContract.VideoEntry.COLUMN_IS_LIVE, false);
            videoValues.put(VideoContract.VideoEntry.COLUMN_AUDIO_CHANNEL_CONFIG, "2.0");
            videoValues.put(VideoContract.VideoEntry.COLUMN_PRODUCTION_YEAR, 2014);
            videoValues.put(VideoContract.VideoEntry.COLUMN_DURATION, 0);
            videoValues.put(VideoContract.VideoEntry.COLUMN_RATING_STYLE,
                    Rating.RATING_5_STARS);
            videoValues.put(VideoContract.VideoEntry.COLUMN_RATING_SCORE, 3.5f);
            if (mContext != null) {
                videoValues.put(VideoContract.VideoEntry.COLUMN_PURCHASE_PRICE,
                        mContext.getResources().getString(R.string.buy_2));
                videoValues.put(VideoContract.VideoEntry.COLUMN_RENTAL_PRICE,
                        mContext.getResources().getString(R.string.rent_2));
                videoValues.put(VideoContract.VideoEntry.COLUMN_ACTION,
                        mContext.getResources().getString(R.string.global_search));
            }

            // TODO: Get these dimensions.
            videoValues.put(VideoContract.VideoEntry.COLUMN_VIDEO_WIDTH, 1280);
            videoValues.put(VideoContract.VideoEntry.COLUMN_VIDEO_HEIGHT, 720);

            videosToInsert.add(videoValues);
        }
    }
    return videosToInsert;
}
 
源代码10 项目: letv   文件: RatingCompatApi21.java
public static Object newUnratedRating(int ratingStyle) {
    return Rating.newUnratedRating(ratingStyle);
}
 
源代码11 项目: letv   文件: RatingCompatApi21.java
public static Object newHeartRating(boolean hasHeart) {
    return Rating.newHeartRating(hasHeart);
}
 
源代码12 项目: letv   文件: RatingCompatApi21.java
public static Object newThumbRating(boolean thumbIsUp) {
    return Rating.newThumbRating(thumbIsUp);
}
 
源代码13 项目: letv   文件: RatingCompatApi21.java
public static Object newStarRating(int starRatingStyle, float starRating) {
    return Rating.newStarRating(starRatingStyle, starRating);
}
 
源代码14 项目: letv   文件: RatingCompatApi21.java
public static Object newPercentageRating(float percent) {
    return Rating.newPercentageRating(percent);
}
 
源代码15 项目: letv   文件: RatingCompatApi21.java
public static boolean isRated(Object ratingObj) {
    return ((Rating) ratingObj).isRated();
}
 
源代码16 项目: letv   文件: RatingCompatApi21.java
public static int getRatingStyle(Object ratingObj) {
    return ((Rating) ratingObj).getRatingStyle();
}
 
源代码17 项目: letv   文件: RatingCompatApi21.java
public static boolean hasHeart(Object ratingObj) {
    return ((Rating) ratingObj).hasHeart();
}
 
源代码18 项目: letv   文件: RatingCompatApi21.java
public static boolean isThumbUp(Object ratingObj) {
    return ((Rating) ratingObj).isThumbUp();
}
 
源代码19 项目: letv   文件: RatingCompatApi21.java
public static float getStarRating(Object ratingObj) {
    return ((Rating) ratingObj).getStarRating();
}
 
源代码20 项目: letv   文件: RatingCompatApi21.java
public static float getPercentRating(Object ratingObj) {
    return ((Rating) ratingObj).getPercentRating();
}
 
@Override
public void onSetRating(Rating rating) {
    mCallback.onSetRating(rating);
}
 
public static void setRating(Object controlsObj, Object ratingObj) {
    ((MediaController.TransportControls)controlsObj).setRating((Rating)ratingObj);
}
 
源代码23 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static Object newUnratedRating(int ratingStyle) {
    return Rating.newUnratedRating(ratingStyle);
}
 
源代码24 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static Object newHeartRating(boolean hasHeart) {
    return Rating.newHeartRating(hasHeart);
}
 
源代码25 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static Object newThumbRating(boolean thumbIsUp) {
    return Rating.newThumbRating(thumbIsUp);
}
 
源代码26 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static Object newStarRating(int starRatingStyle, float starRating) {
    return Rating.newStarRating(starRatingStyle, starRating);
}
 
源代码27 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static Object newPercentageRating(float percent) {
    return Rating.newPercentageRating(percent);
}
 
源代码28 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static boolean isRated(Object ratingObj) {
    return ((Rating)ratingObj).isRated();
}
 
源代码29 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static int getRatingStyle(Object ratingObj) {
    return ((Rating)ratingObj).getRatingStyle();
}
 
源代码30 项目: adt-leanback-support   文件: RatingCompatApi21.java
public static boolean hasHeart(Object ratingObj) {
    return ((Rating)ratingObj).hasHeart();
}
 
 类所在包
 类方法
 同包方法