PercentageRating


public final class PercentageRating extends Rating


A rating expressed as a percentage.

Summary

Constants

static final Bundleable.Creator<PercentageRating>

This field is deprecated.

Use fromBundle instead.

Public fields

final float

Public constructors

Creates a unrated instance.

PercentageRating(@FloatRange(from = 0, to = 100) float percent)

Creates a rated instance with the given percentage.

Public methods

boolean
static PercentageRating

Restores a PercentageRating from a Bundle.

float

Returns the percent value of this rating.

int
boolean

Whether the rating exists or not.

Bundle

Returns a Bundle representing the information stored in this object.

Inherited Constants

From androidx.media3.common.Rating
static final Bundleable.Creator<Rating>

This field is deprecated.

Use fromBundle instead.

Inherited methods

From androidx.media3.common.Rating
static Rating

Restores a Rating from a Bundle.

Constants

CREATOR

@UnstableApi
public static final Bundleable.Creator<PercentageRatingCREATOR

Object that can restore a PercentageRating from a Bundle.

Public fields

percent

public final float percent

Public constructors

PercentageRating

public PercentageRating()

Creates a unrated instance.

PercentageRating

public PercentageRating(@FloatRange(from = 0, to = 100) float percent)

Creates a rated instance with the given percentage.

Parameters
@FloatRange(from = 0, to = 100) float percent

The percentage value of the rating.

Public methods

equals

public boolean equals(@Nullable Object obj)

fromBundle

@UnstableApi
public static PercentageRating fromBundle(Bundle bundle)

Restores a PercentageRating from a Bundle.

getPercent

public float getPercent()

Returns the percent value of this rating. Will be within the range [0f, 100f], or RATING_UNSET if unrated.

hashCode

public int hashCode()

isRated

public boolean isRated()

Whether the rating exists or not.

toBundle

@UnstableApi
public Bundle toBundle()

Returns a Bundle representing the information stored in this object.