/**
* A Uri formatted String representing the content. This value is specific to the
* service providing the content. It may be used with
- * {@link MediaController2#playFromUri(String, Bundle)}
+ * {@link MediaController2#playFromUri(Uri, Bundle)}
* to initiate playback when provided by a {@link MediaBrowser2} connected to
* the same app.
*/
public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI";
/**
+ * The radio frequency in Float format if this metdata representing radio content.
+ */
+ public static final String METADATA_KEY_RADIO_FREQUENCY =
+ "android.media.metadata.RADIO_FREQUENCY";
+
+ /**
+ * The radio callsign in String format if this metdata representing radio content.
+ */
+ public static final String METADATA_KEY_RADIO_CALLSIGN =
+ "android.media.metadata.RADIO_CALLSIGN";
+
+ /**
* The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth
* AVRCP 1.5. It should be one of the following:
* <ul>
/**
* A {@link Bundle} extra.
- * @hide
*/
- public static final String METADATA_KEY_EXTRA = "android.media.metadata.EXTRA";
+ public static final String METADATA_KEY_EXTRAS = "android.media.metadata.EXTRAS";
/**
* @hide
METADATA_KEY_DATE, METADATA_KEY_GENRE, METADATA_KEY_ALBUM_ARTIST, METADATA_KEY_ART_URI,
METADATA_KEY_ALBUM_ART_URI, METADATA_KEY_DISPLAY_TITLE, METADATA_KEY_DISPLAY_SUBTITLE,
METADATA_KEY_DISPLAY_DESCRIPTION, METADATA_KEY_DISPLAY_ICON_URI,
- METADATA_KEY_MEDIA_ID, METADATA_KEY_MEDIA_URI})
+ METADATA_KEY_MEDIA_ID, METADATA_KEY_MEDIA_URI, METADATA_KEY_RADIO_CALLSIGN})
@Retention(RetentionPolicy.SOURCE)
public @interface TextKey {}
@Retention(RetentionPolicy.SOURCE)
public @interface RatingKey {}
+ /**
+ * @hide
+ */
+ @StringDef({METADATA_KEY_RADIO_FREQUENCY})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface FloatKey {}
+
private final MediaMetadata2Provider mProvider;
/**
}
/**
- * Returns the value associated with the given key, or null if no mapping of
- * the desired type exists for the given key or a null value is explicitly
- * associated with the key.
+ * Returns the media id, or {@code null} if the id doesn't exist.
+ *<p>
+ * This is equivalent to the {@link #getString(String)} with the {@link #METADATA_KEY_MEDIA_ID}.
*
* @return media id. Can be {@code null}
* @see #METADATA_KEY_MEDIA_ID
}
/**
+ * Return the value associated with the given key, or 0.0f if no long exists
+ * for the given key.
+ *
+ * @param key The key the value is stored under
+ * @return a float value
+ */
+ public float getFloat(@NonNull @FloatKey String key) {
+ return mProvider.getFloat_impl(key);
+ }
+
+ /**
* Get the extra {@link Bundle} from the metadata object.
*
* @return A {@link Bundle} or {@code null}
*/
- public @Nullable Bundle getExtra() {
- return mProvider.getExtra_impl();
+ public @Nullable Bundle getExtras() {
+ return mProvider.getExtras_impl();
}
/**
* <li>{@link #METADATA_KEY_DISPLAY_SUBTITLE}</li>
* <li>{@link #METADATA_KEY_DISPLAY_DESCRIPTION}</li>
* <li>{@link #METADATA_KEY_DISPLAY_ICON_URI}</li>
+ * <li>{@link #METADATA_KEY_RADIO_CALLSIGN}</li>
* </ul>
*
* @param key The key for referencing this value
}
/**
- * Set an extra {@link Bundle} into the metadata.
+ * Put a float value into the metadata. Custom keys may be used, but if
+ * the METADATA_KEYs defined in this class are used they may only be one
+ * of the following:
+ * <ul>
+ * <li>{@link #METADATA_KEY_RADIO_FREQUENCY}</li>
+ * </ul>
+ *
+ * @param key The key for referencing this value
+ * @param value The float value to store
+ * @return The Builder to allow chaining
+ */
+ public @NonNull Builder putFloat(@NonNull @LongKey String key, float value) {
+ return mProvider.putFloat_impl(key, value);
+ }
+
+ /**
+ * Set a bundle of extras.
+ *
+ * @param extras The extras to include with this description or null.
+ * @return The Builder to allow chaining
*/
- public @NonNull Builder setExtra(@Nullable Bundle bundle) {
- return mProvider.setExtra_impl(bundle);
+ public Builder setExtras(@Nullable Bundle extras) {
+ return mProvider.setExtras_impl(extras);
}
/**