PercentageRating
class PercentageRating : Rating
kotlin.Any | |
↳ | androidx.media2.session.PercentageRating |
A class for rating expressed as a percentage.
Summary
Public constructors | |
---|---|
<init>() Creates a unrated PercentageRating instance. |
|
Creates a PercentageRating instance with the given percentage. |
Public methods | |
---|---|
Boolean | |
Float |
Returns the percentage-based rating value. |
Int |
hashCode() |
Boolean |
isRated() |
String |
toString() |
Public constructors
<init>
PercentageRating()
Creates a unrated PercentageRating instance.
<init>
PercentageRating(percent: Float)
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
getPercentRating
fun getPercentRating(): Float
Returns the percentage-based rating value.
Return | |
---|---|
Float |
a rating value greater or equal to 0.0f, or a negative value if it is unrated. |
hashCode
fun hashCode(): Int
isRated
fun isRated(): Boolean
toString
fun toString(): String