RatingCompat

public final class RatingCompat
extends Object implements Parcelable

java.lang.Object
   ↳ android.support.v4.media.RatingCompat


A class to encapsulate rating information used as content metadata. A rating is defined by its rating style (see RATING_HEART, RATING_THUMB_UP_DOWN, RATING_3_STARS, RATING_4_STARS, RATING_5_STARS or RATING_PERCENTAGE) and the actual rating value (which may be defined as "unrated"), both of which are defined when the rating instance is constructed through one of the factory methods.

Summary

Constants

int RATING_3_STARS

A rating style with 0 to 3 stars.

int RATING_4_STARS

A rating style with 0 to 4 stars.

int RATING_5_STARS

A rating style with 0 to 5 stars.

int RATING_HEART

A rating style with a single degree of rating, "heart" vs "no heart".

int RATING_NONE

Indicates a rating style is not supported.

int RATING_PERCENTAGE

A rating style expressed as a percentage.

int RATING_THUMB_UP_DOWN

A rating style for "thumb up" vs "thumb down".

Inherited constants

Fields

public static final Creator<RatingCompat> CREATOR

Public methods

int describeContents()
static RatingCompat fromRating(Object ratingObj)

Creates an instance from a framework Rating object.

float getPercentRating()

Return the percentage-based rating value.

Object getRating()

Gets the underlying framework Rating object.

int getRatingStyle()

Return the rating style.

float getStarRating()

Return the star-based rating value.

boolean hasHeart()

Return whether the rating is "heart selected".

boolean isRated()

Return whether there is a rating value available.

boolean isThumbUp()

Return whether the rating is "thumb up".

static RatingCompat newHeartRating(boolean hasHeart)

Return a Rating instance with a heart-based rating.

static RatingCompat newPercentageRating(float percent)

Return a Rating instance with a percentage-based rating.

static RatingCompat newStarRating(int starRatingStyle, float starRating)

Return a Rating instance with a star-based rating.

static RatingCompat newThumbRating(boolean thumbIsUp)

Return a Rating instance with a thumb-based rating.

static RatingCompat newUnratedRating(int ratingStyle)

Return a Rating instance with no rating.

String toString()
void writeToParcel(Parcel dest, int flags)

Inherited methods

Constants

RATING_3_STARS

public static final int RATING_3_STARS

A rating style with 0 to 3 stars.

Constant Value: 3 (0x00000003)

RATING_4_STARS

public static final int RATING_4_STARS

A rating style with 0 to 4 stars.

Constant Value: 4 (0x00000004)

RATING_5_STARS

public static final int RAT