Home | History | Annotate | Download | only in media

Lines Matching defs:rating

21 import android.media.Rating;
34 * A class to encapsulate rating information used as content metadata.
35 * A rating is defined by its rating style (see {@link #RATING_HEART},
37 * {@link #RATING_5_STARS} or {@link #RATING_PERCENTAGE}) and the actual rating value (which may
38 * be defined as "unrated"), both of which are defined when the rating instance is constructed
42 private final static String TAG = "Rating";
62 * Indicates a rating style is not supported. A Rating will never have this
64 * Rating.
69 * A rating style with a single degree of rating, "heart" vs "no heart". Can be used to
75 * A rating style for "thumb up" vs "thumb down".
80 * A rating style with 0 to 3 stars.
85 * A rating style with 0 to 4 stars.
90 * A rating style with 0 to 5 stars.
95 * A rating style expressed as a percentage.
104 private Object mRatingObj; // framework Rating object
106 RatingCompat(@Style int ratingStyle, float rating) {
108 mRatingValue = rating;
113 return "Rating:style=" + mRatingStyle + " rating="
131 * Rebuilds a Rating previously stored with writeToParcel().
132 * @param p Parcel object to read the Rating from
133 * @return a new Rating created from the data in the parcel
147 * Return a Rating instance with no rating.
148 * Create and return a new Rating instance with no rating known for the given
149 * rating style.
153 * @return null if an invalid rating style is passed, a new Rating instance otherwise.
170 * Return a Rating instance with a heart-based rating.
171 * Create and return a new Rating instance with a rating style of {@link #RATING_HEART},
172 * and a heart-based rating.
173 * @param hasHeart true for a "heart selected" rating, false for "heart unselected".
174 * @return a new Rating instance.
181 * Return a Rating instance with a thumb-based rating.
182 * Create and return a new Rating instance with a {@link #RATING_THUMB_UP_DOWN}
183 * rating style, and a "thumb up" or "thumb down" rating.
184 * @param thumbIsUp true for a "thumb up" rating, false for "thumb down".
185 * @return a new Rating instance.
192 * Return a Rating instance with a star-based rating.
193 * Create and return a new Rating instance with one of the star-base rating styles
195 * be used to represent an average rating value, which might not be an integer number of stars.
199 * the rating style.
200 * @return null if the rating style is invalid, or the rating is out of range,
201 * a new Rating instance otherwise.
217 Log.e(TAG, "Invalid rating style (" + starRatingStyle + ") for a star rating");
221 Log.e(TAG, "Trying to set out of range star-based rating");
228 * Return a Rating instance with a percentage-based rating.
229 * Create and return a new Rating instance with a {@link #RATING_PERCENTAGE}
230 * rating style, and a rating of the given percentage.
231 * @param percent the value of the rating
232 * @return null if the rating is out of range, a new Rating instance otherwise.
236 Log.e(TAG, "Invalid percentage-based rating value");
244 * Return whether there is a rating value available.
252 * Return the rating style.
263 * Return whether the rating is "heart selected".
264 * @return true if the rating is "heart selected", false if the rating is "heart unselected",
265 * if the rating style is not {@link #RATING_HEART} or if it is unrated.
276 * Return whether the rating is "thumb up".
277 * @return true if the rating is "thumb up", false if the rating is "thumb down",
278 * if the rating style is not {@link #RATING_THUMB_UP_DOWN} or if it is unrated.
289 * Return the star-based rating value.
290 * @return a rating value greater or equal to 0.0f, or a negative value if the rating style is
308 * Return the percentage-based rating value.
309 * @return a rating value greater or equal to 0.0f, or a negative value if the rating style is
321 * Creates an instance from a framework {@link android.media.Rating} object.
326 * @param ratingObj A {@link android.media.Rating} object, or null if none.
331 final int ratingStyle = ((Rating) ratingObj).getRatingStyle();
332 final RatingCompat rating;
333 if (((Rating) ratingObj).isRated()) {
336 rating = newHeartRating(((Rating) ratingObj).hasHeart());
339 rating = newThumbRating(((Rating) ratingObj).isThumbUp());
344 rating = newStarRating(ratingStyle,
345 ((Rating) ratingObj).getStarRating());
348 rating = newPercentageRating(
349 ((Rating) ratingObj).getPercentRating());
355 rating = newUnratedRating(ratingStyle);
357 rating.mRatingObj = ratingObj;
358 return rating;
365 * Gets the underlying framework {@link android.media.Rating} object.
370 * @return An equivalent {@link android.media.Rating} object, or null if none.
377 mRatingObj = Rating.newHeartRating(hasHeart());
380 mRatingObj = Rating.newThumbRating(isThumbUp());
385 mRatingObj = Rating.newStarRating(mRatingStyle,
389 mRatingObj = Rating.newPercentageRating(getPercentRating());
395 mRatingObj = Rating.newUnratedRating(mRatingStyle);