class StarRating : Rating


A rating expressed as a fractional number of stars.

Summary

Public constructors

StarRating(maxStars: @IntRange(from = 1) Int)

Creates a unrated instance with maxStars.

StarRating(
    maxStars: @IntRange(from = 1) Int,
    starRating: @FloatRange(from = 0.0) Float
)

Creates a rated instance with maxStars and the given fractional number of stars.

Public functions

Boolean
equals(obj: Any?)
java-static StarRating!

Restores a StarRating from a Bundle.

Int
Boolean

Whether the rating exists or not.

Bundle!

Returns a Bundle representing the information stored in this rating.

Public properties

@IntRange(from = 1) Int
Float

Inherited functions

From androidx.media3.common.Rating
java-static Rating!

Restores a Rating from a Bundle.

Public constructors

StarRating

StarRating(maxStars: @IntRange(from = 1) Int)

Creates a unrated instance with maxStars. If maxStars is not a positive integer, it will throw an IllegalArgumentException.

Parameters
maxStars: @IntRange(from = 1) Int

The maximum number of stars this rating can have.

StarRating

StarRating(
    maxStars: @IntRange(from = 1) Int,
    starRating: @FloatRange(from = 0.0) Float
)

Creates a rated instance with maxStars and the given fractional number of stars. Non-integer values may be used to represent an average rating value. If maxStars is not a positive integer or starRating is out of range, it will throw an .

Parameters
maxStars: @IntRange(from = 1) Int

The maximum number of stars this rating can have.

starRating: @FloatRange(from = 0.0) Float

A fractional number of stars of this rating from 0f to maxStars.

Public functions

equals

fun equals(obj: Any?): Boolean

fromBundle

@UnstableApi
java-static fun fromBundle(bundle: Bundle!): StarRating!

Restores a StarRating from a Bundle.

hashCode

fun hashCode(): Int

isRated

fun isRated(): Boolean

Whether the rating exists or not.

toBundle

@UnstableApi
fun toBundle(): Bundle!

Returns a Bundle representing the information stored in this rating.

Public properties

maxStars

val maxStars: @IntRange(from = 1) Int

starRating

val starRatingFloat