Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

PercentageRating

class PercentageRating : Rating
kotlin.Any
   ↳ androidx.media2.session.PercentageRating

A class for rating expressed as a percentage.

Summary

Public constructors

Creates a unrated PercentageRating instance.

<init>(percent: Float)

Creates a PercentageRating instance with the given percentage.

Public methods

Boolean
equals(other: Any?)

Float

Returns the percentage-based rating value.

Int

Boolean

String

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

equals

fun equals(other: Any?): Boolean

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