added in version 22.1.0
belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1

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

From interface android.os.Parcelable

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

From class java.lang.Object