RatingCompat
class RatingCompat : Parcelable
kotlin.Any | |
↳ | 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 |
|
---|---|
static Int |
A rating style with 0 to 3 stars. |
static Int |
A rating style with 0 to 4 stars. |
static Int |
A rating style with 0 to 5 stars. |
static Int |
A rating style with a single degree of rating, "heart" vs "no heart". |
static Int |
Indicates a rating style is not supported. |
static Int |
A rating style expressed as a percentage. |
static Int |
A rating style for "thumb up" vs "thumb down". |
Public methods |
|
---|---|
Int | |
static RatingCompat! |
fromRating(ratingObj: Any!) Creates an instance from a framework |
Float |
Return the percentage-based rating value. |
Any! |
Gets the underlying framework |
Int |
Return the rating style. |
Float |
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 |
Return whether the rating is "thumb up". |
static RatingCompat! |
newHeartRating(hasHeart: Boolean) Return a Rating instance with a heart-based rating. |
static RatingCompat! |
newPercentageRating(percent: Float) Return a Rating instance with a percentage-based rating. |
static RatingCompat! |
newStarRating(starRatingStyle: Int, starRating: Float) Return a Rating instance with a star-based rating. |
static RatingCompat! |
newThumbRating(thumbIsUp: Boolean) Return a Rating instance with a thumb-based rating. |
static RatingCompat! |
newUnratedRating(ratingStyle: Int) Return a Rating instance with no rating. |
String |
toString() |
Unit |
writeToParcel(dest: Parcel!, flags: Int) |
Properties |
|
---|---|
static Creator<RatingCompat!>! |
Constants
RATING_HEART
static val RATING_HEART: Int
A rating style with a single degree of rating, "heart" vs "no heart". Can be used to indicate the content referred to is a favorite (or not).
Value: 1
RATING_NONE
static val RATING_NONE: Int
Indicates a rating style is not supported. A Rating will never have this type, but can be used by other classes to indicate they do not support Rating.
Value: 0
RATING_PERCENTAGE
static val RATING_PERCENTAGE: Int
A rating style expressed as a percentage.
Value: 6
RATING_THUMB_UP_DOWN
static val RATING_THUMB_UP_DOWN: Int
A rating style for "thumb up" vs "thumb down".
Value: 2
Public methods
describeContents
fun describeContents(): Int
fromRating
static fun fromRating(ratingObj: Any!): RatingCompat!
Creates an instance from a framework android.media.Rating
object.
This method is only supported on API 19+.
Parameters | |
---|---|
ratingObj |
Any!: A android.media.Rating object, or null if none. |
Return | |
---|---|
RatingCompat!: An equivalent RatingCompat object, or null if none. |