Fields Summary |
---|
private final String | mMediaIdA unique persistent id for the content or null. |
private final CharSequence | mTitleA primary title suitable for display or null. |
private final CharSequence | mSubtitleA subtitle suitable for display or null. |
private final CharSequence | mDescriptionA description suitable for display or null. |
private final android.graphics.Bitmap | mIconA bitmap icon suitable for display or null. |
private final android.net.Uri | mIconUriA Uri for an icon suitable for display or null. |
private final android.os.Bundle | mExtrasExtras for opaque use by apps/system. |
private Object | mDescriptionObjA cached copy of the equivalent framework object. |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
public int | describeContents()
return 0;
|
public static android.support.v4.media.MediaDescriptionCompat | fromMediaDescription(java.lang.Object descriptionObj)Creates an instance from a framework
{@link android.media.MediaDescription} object.
This method is only supported on API 21+.
if (descriptionObj == null || Build.VERSION.SDK_INT < 21) {
return null;
}
Builder bob = new Builder();
bob.setMediaId(MediaDescriptionCompatApi21.getMediaId(descriptionObj));
bob.setTitle(MediaDescriptionCompatApi21.getTitle(descriptionObj));
bob.setSubtitle(MediaDescriptionCompatApi21.getSubtitle(descriptionObj));
bob.setDescription(MediaDescriptionCompatApi21.getDescription(descriptionObj));
bob.setIconBitmap(MediaDescriptionCompatApi21.getIconBitmap(descriptionObj));
bob.setIconUri(MediaDescriptionCompatApi21.getIconUri(descriptionObj));
bob.setExtras(MediaDescriptionCompatApi21.getExtras(descriptionObj));
MediaDescriptionCompat descriptionCompat = bob.build();
descriptionCompat.mDescriptionObj = descriptionObj;
return descriptionCompat;
|
public java.lang.CharSequence | getDescription()Returns a description suitable for display or null.
return mDescription;
|
public android.os.Bundle | getExtras()Returns any extras that were added to the description.
return mExtras;
|
public android.graphics.Bitmap | getIconBitmap()Returns a bitmap icon suitable for display or null.
return mIcon;
|
public android.net.Uri | getIconUri()Returns a Uri for an icon suitable for display or null.
return mIconUri;
|
public java.lang.Object | getMediaDescription()Gets the underlying framework {@link android.media.MediaDescription}
object.
This method is only supported on
{@link android.os.Build.VERSION_CODES#LOLLIPOP} and later.
if (mDescriptionObj != null || Build.VERSION.SDK_INT < 21) {
return mDescriptionObj;
}
Object bob = MediaDescriptionCompatApi21.Builder.newInstance();
MediaDescriptionCompatApi21.Builder.setMediaId(bob, mMediaId);
MediaDescriptionCompatApi21.Builder.setTitle(bob, mTitle);
MediaDescriptionCompatApi21.Builder.setSubtitle(bob, mSubtitle);
MediaDescriptionCompatApi21.Builder.setDescription(bob, mDescription);
MediaDescriptionCompatApi21.Builder.setIconBitmap(bob, mIcon);
MediaDescriptionCompatApi21.Builder.setIconUri(bob, mIconUri);
MediaDescriptionCompatApi21.Builder.setExtras(bob, mExtras);
mDescriptionObj = MediaDescriptionCompatApi21.Builder.build(bob);
return mDescriptionObj;
|
public java.lang.String | getMediaId()Returns the media id or null. See
{@link MediaMetadataCompat#METADATA_KEY_MEDIA_ID}.
return mMediaId;
|
public java.lang.CharSequence | getSubtitle()Returns a subtitle suitable for display or null.
return mSubtitle;
|
public java.lang.CharSequence | getTitle()Returns a title suitable for display or null.
return mTitle;
|
public java.lang.String | toString()
return mTitle + ", " + mSubtitle + ", " + mDescription;
|
public void | writeToParcel(android.os.Parcel dest, int flags)
if (Build.VERSION.SDK_INT < 21) {
dest.writeString(mMediaId);
TextUtils.writeToParcel(mTitle, dest, flags);
TextUtils.writeToParcel(mSubtitle, dest, flags);
TextUtils.writeToParcel(mDescription, dest, flags);
dest.writeParcelable(mIcon, flags);
dest.writeParcelable(mIconUri, flags);
dest.writeBundle(mExtras);
} else {
MediaDescriptionCompatApi21.writeToParcel(getMediaDescription(), dest, flags);
}
|