}
/**
- * Get the rating type supported by the session. One of:
- * <ul>
- * <li>{@link Rating2#RATING_NONE}</li>
- * <li>{@link Rating2#RATING_HEART}</li>
- * <li>{@link Rating2#RATING_THUMB_UP_DOWN}</li>
- * <li>{@link Rating2#RATING_3_STARS}</li>
- * <li>{@link Rating2#RATING_4_STARS}</li>
- * <li>{@link Rating2#RATING_5_STARS}</li>
- * <li>{@link Rating2#RATING_PERCENTAGE}</li>
- * </ul>
- *
- * @return The supported rating type
- */
- public int getRatingType() {
- return mProvider.getRatingType_impl();
- }
-
- /**
* Get an intent for launching UI associated with this session if one exists.
*
* @return A {@link PendingIntent} to launch UI or null.
/**
* Rate the media. This will cause the rating to be set for the current user.
- * The Rating type must match the type returned by {@link #getRatingType()}.
+ * The rating style must follow the user rating style from the session.
+ * You can get the rating style from the session through the
+ * {@link MediaMetadata#getRating(String)} with the key
+ * {@link MediaMetadata#METADATA_KEY_USER_RATING}.
+ * <p>
+ * If the user rating was {@code null}, the media item does not accept setting user rating.
*
* @param mediaId The id of the media
* @param rating The rating to set
}
@Override
- public MediaLibrarySessionBuilder setRatingType(int type) {
- return super.setRatingType(type);
- }
-
- @Override
public MediaLibrarySessionBuilder setSessionActivity(@Nullable PendingIntent pi) {
return super.setSessionActivity(pi);
}
/**
* Return a {@link Rating2} for the given key or null if no rating exists for
* the given key.
+ * <p>
+ * For the {@link #METADATA_KEY_USER_RATING}, A {@code null} return value means that user rating
+ * cannot be set by {@link MediaController2}.
*
* @param key The key the value is stored under
* @return A {@link Rating2} or {@code null}
// TODO(jaewan): Should we define IntDef? Currently we don't have to allow subclass to add more.
// TODO(jaewan): Shouldn't we pull out?
// TODO(jaewan): Should we also protect getters not related with metadata?
- // Getters are getRatingType(), getPlaybackState(), getSessionActivity(),
- // getPlaylistParams())
+ // Getters are getPlaybackState(), getSessionActivity(), getPlaylistParams()
// Next ID: 23
/**
* Command code for the custom command which can be defined by string action in the
/**
* Called when a controller set rating of a media item through
* {@link MediaController2#setRating(String, Rating2)}.
+ * <p>
+ * To allow setting user rating for a {@link MediaItem2}, the media item's metadata
+ * should have {@link Rating2} with the key {@link MediaMetadata#METADATA_KEY_USER_RATING},
+ * in order to provide possible rating style for controller. Controller will follow the
+ * rating style.
*
* @param controller controller information
* @param mediaId media id from the controller
}
/**
- * Set the style of rating used by this session. Apps trying to set the
- * rating should use this style. Must be one of the following:
- * <ul>
- * <li>{@link Rating2#RATING_NONE}</li>
- * <li>{@link Rating2#RATING_3_STARS}</li>
- * <li>{@link Rating2#RATING_4_STARS}</li>
- * <li>{@link Rating2#RATING_5_STARS}</li>
- * <li>{@link Rating2#RATING_HEART}</li>
- * <li>{@link Rating2#RATING_PERCENTAGE}</li>
- * <li>{@link Rating2#RATING_THUMB_UP_DOWN}</li>
- * </ul>
- */
- U setRatingType(@Rating2.Style int type) {
- mProvider.setRatingType_impl(type);
- return (U) this;
- }
-
- /**
* Set an intent for launching UI for this Session. This can be used as a
* quick link to an ongoing media screen. The intent should be for an
* activity that may be started using {@link Context#startActivity(Intent)}.
}
@Override
- public Builder setRatingType(@Rating2.Style int type) {
- return super.setRatingType(type);
- }
-
- @Override
public Builder setSessionActivity(@Nullable PendingIntent pi) {
return super.setSessionActivity(pi);
}
boolean isConnected_impl();
PendingIntent getSessionActivity_impl();
- int getRatingType_impl();
void setVolumeTo_impl(int value, int flags);
void adjustVolume_impl(int direction, int flags);
interface BuilderBaseProvider<T extends MediaSession2, C extends SessionCallback> {
void setVolumeProvider_impl(VolumeProvider2 volumeProvider);
- void setRatingType_impl(int type);
void setSessionActivity_impl(PendingIntent pi);
void setId_impl(String id);
void setSessionCallback_impl(Executor executor, C callback);