PercentageRating

public final class PercentageRating
extends Object implements Rating

java.lang.Object
   ↳ androidx.media2.session.PercentageRating


A class for rating expressed as a percentage.

Summary

Public constructors

PercentageRating()

Creates a unrated PercentageRating instance.

PercentageRating(float percent)

Creates a PercentageRating instance with the given percentage.

Public methods

boolean equals(Object obj)
float getPercentRating()

Returns the percentage-based rating value.

int hashCode()
boolean isRated()

Returns whether there is a rating value available.

String toString()

Inherited methods

Public constructors

PercentageRating

public PercentageRating ()

Creates a unrated PercentageRating instance.

PercentageRating

public PercentageRating (float percent)

Creates a PercentageRating instance with the given percentage. If percent is less than 0f or greater than 100f, it will throw IllegalArgumentException.

Parameters
percent float: the value of the rating

Public methods

equals

public boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getPercentRating

public float getPercentRating ()

Returns the percentage-based rating value.

Returns
float a rating value greater or equal to 0.0f, or a negative value if it is unrated.

hashCode

public int hashCode ()

Returns
int

isRated

public boolean isRated ()

Returns whether there is a rating value available.

Returns
boolean true if there is an available rating value.

toString

public String toString ()

Returns
String