MediaDescriptionCompat.java 9.25 KB
package android.support.v4.media;

import android.graphics.Bitmap;
import android.media.MediaDescription;
import android.media.MediaDescription.Builder;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.text.TextUtils;

public final class MediaDescriptionCompat
  implements Parcelable
{
  public static final long BT_FOLDER_TYPE_ALBUMS = 2L;
  public static final long BT_FOLDER_TYPE_ARTISTS = 3L;
  public static final long BT_FOLDER_TYPE_GENRES = 4L;
  public static final long BT_FOLDER_TYPE_MIXED = 0L;
  public static final long BT_FOLDER_TYPE_PLAYLISTS = 5L;
  public static final long BT_FOLDER_TYPE_TITLES = 1L;
  public static final long BT_FOLDER_TYPE_YEARS = 6L;
  public static final Parcelable.Creator<MediaDescriptionCompat> CREATOR = new Parcelable.Creator() {};
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public static final String DESCRIPTION_KEY_MEDIA_URI = "android.support.v4.media.description.MEDIA_URI";
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public static final String DESCRIPTION_KEY_NULL_BUNDLE_FLAG = "android.support.v4.media.description.NULL_BUNDLE_FLAG";
  public static final String EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE";
  private final String a;
  private final CharSequence b;
  private final CharSequence c;
  private final CharSequence d;
  private final Bitmap e;
  private final Uri f;
  private final Bundle g;
  private final Uri h;
  private Object i;
  
  MediaDescriptionCompat(Parcel paramParcel)
  {
    this.a = paramParcel.readString();
    this.b = ((CharSequence)TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(paramParcel));
    this.c = ((CharSequence)TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(paramParcel));
    this.d = ((CharSequence)TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(paramParcel));
    this.e = ((Bitmap)paramParcel.readParcelable(null));
    this.f = ((Uri)paramParcel.readParcelable(null));
    this.g = paramParcel.readBundle();
    this.h = ((Uri)paramParcel.readParcelable(null));
  }
  
  MediaDescriptionCompat(String paramString, CharSequence paramCharSequence1, CharSequence paramCharSequence2, CharSequence paramCharSequence3, Bitmap paramBitmap, Uri paramUri1, Bundle paramBundle, Uri paramUri2)
  {
    this.a = paramString;
    this.b = paramCharSequence1;
    this.c = paramCharSequence2;
    this.d = paramCharSequence3;
    this.e = paramBitmap;
    this.f = paramUri1;
    this.g = paramBundle;
    this.h = paramUri2;
  }
  
  public static MediaDescriptionCompat fromMediaDescription(Object paramObject)
  {
    if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
      return null;
    }
    Builder localBuilder = new Builder();
    localBuilder.setMediaId(((MediaDescription)paramObject).getMediaId());
    localBuilder.setTitle(((MediaDescription)paramObject).getTitle());
    localBuilder.setSubtitle(((MediaDescription)paramObject).getSubtitle());
    localBuilder.setDescription(((MediaDescription)paramObject).getDescription());
    localBuilder.setIconBitmap(((MediaDescription)paramObject).getIconBitmap());
    localBuilder.setIconUri(((MediaDescription)paramObject).getIconUri());
    Bundle localBundle = ((MediaDescription)paramObject).getExtras();
    Object localObject;
    if (localBundle == null)
    {
      localObject = null;
      if (localObject == null) {
        break label184;
      }
      if ((!localBundle.containsKey("android.support.v4.media.description.NULL_BUNDLE_FLAG")) || (localBundle.size() != 2)) {
        break label172;
      }
      localBundle = null;
      label131:
      localBuilder.setExtras(localBundle);
      if (localObject == null) {
        break label187;
      }
      localBuilder.setMediaUri((Uri)localObject);
    }
    for (;;)
    {
      localObject = localBuilder.build();
      ((MediaDescriptionCompat)localObject).i = paramObject;
      return (MediaDescriptionCompat)localObject;
      localObject = (Uri)localBundle.getParcelable("android.support.v4.media.description.MEDIA_URI");
      break;
      label172:
      localBundle.remove("android.support.v4.media.description.MEDIA_URI");
      localBundle.remove("android.support.v4.media.description.NULL_BUNDLE_FLAG");
      label184:
      break label131;
      label187:
      if (Build.VERSION.SDK_INT >= 23) {
        localBuilder.setMediaUri(((MediaDescription)paramObject).getMediaUri());
      }
    }
  }
  
  public final int describeContents()
  {
    return 0;
  }
  
  @Nullable
  public final CharSequence getDescription()
  {
    return this.d;
  }
  
  @Nullable
  public final Bundle getExtras()
  {
    return this.g;
  }
  
  @Nullable
  public final Bitmap getIconBitmap()
  {
    return this.e;
  }
  
  @Nullable
  public final Uri getIconUri()
  {
    return this.f;
  }
  
  public final Object getMediaDescription()
  {
    if ((this.i != null) || (Build.VERSION.SDK_INT < 21)) {
      return this.i;
    }
    MediaDescription.Builder localBuilder = new MediaDescription.Builder();
    Object localObject = this.a;
    ((MediaDescription.Builder)localBuilder).setMediaId((String)localObject);
    localObject = this.b;
    ((MediaDescription.Builder)localBuilder).setTitle((CharSequence)localObject);
    localObject = this.c;
    ((MediaDescription.Builder)localBuilder).setSubtitle((CharSequence)localObject);
    localObject = this.d;
    ((MediaDescription.Builder)localBuilder).setDescription((CharSequence)localObject);
    localObject = this.e;
    ((MediaDescription.Builder)localBuilder).setIconBitmap((Bitmap)localObject);
    localObject = this.f;
    ((MediaDescription.Builder)localBuilder).setIconUri((Uri)localObject);
    Bundle localBundle = this.g;
    if ((Build.VERSION.SDK_INT < 23) && (this.h != null))
    {
      localObject = localBundle;
      if (localBundle == null)
      {
        localObject = new Bundle();
        ((Bundle)localObject).putBoolean("android.support.v4.media.description.NULL_BUNDLE_FLAG", true);
      }
      ((Bundle)localObject).putParcelable("android.support.v4.media.description.MEDIA_URI", this.h);
    }
    for (;;)
    {
      ((MediaDescription.Builder)localBuilder).setExtras((Bundle)localObject);
      if (Build.VERSION.SDK_INT >= 23)
      {
        localObject = this.h;
        ((MediaDescription.Builder)localBuilder).setMediaUri((Uri)localObject);
      }
      this.i = ((MediaDescription.Builder)localBuilder).build();
      return this.i;
      localObject = localBundle;
    }
  }
  
  @Nullable
  public final String getMediaId()
  {
    return this.a;
  }
  
  @Nullable
  public final Uri getMediaUri()
  {
    return this.h;
  }
  
  @Nullable
  public final CharSequence getSubtitle()
  {
    return this.c;
  }
  
  @Nullable
  public final CharSequence getTitle()
  {
    return this.b;
  }
  
  public final String toString()
  {
    return this.b + ", " + this.c + ", " + this.d;
  }
  
  public final void writeToParcel(Parcel paramParcel, int paramInt)
  {
    if (Build.VERSION.SDK_INT < 21)
    {
      paramParcel.writeString(this.a);
      TextUtils.writeToParcel(this.b, paramParcel, paramInt);
      TextUtils.writeToParcel(this.c, paramParcel, paramInt);
      TextUtils.writeToParcel(this.d, paramParcel, paramInt);
      paramParcel.writeParcelable(this.e, paramInt);
      paramParcel.writeParcelable(this.f, paramInt);
      paramParcel.writeBundle(this.g);
      paramParcel.writeParcelable(this.h, paramInt);
      return;
    }
    ((MediaDescription)getMediaDescription()).writeToParcel(paramParcel, paramInt);
  }
  
  public static final class Builder
  {
    private String a;
    private CharSequence b;
    private CharSequence c;
    private CharSequence d;
    private Bitmap e;
    private Uri f;
    private Bundle g;
    private Uri h;
    
    public final MediaDescriptionCompat build()
    {
      return new MediaDescriptionCompat(this.a, this.b, this.c, this.d, this.e, this.f, this.g, this.h);
    }
    
    public final Builder setDescription(@Nullable CharSequence paramCharSequence)
    {
      this.d = paramCharSequence;
      return this;
    }
    
    public final Builder setExtras(@Nullable Bundle paramBundle)
    {
      this.g = paramBundle;
      return this;
    }
    
    public final Builder setIconBitmap(@Nullable Bitmap paramBitmap)
    {
      this.e = paramBitmap;
      return this;
    }
    
    public final Builder setIconUri(@Nullable Uri paramUri)
    {
      this.f = paramUri;
      return this;
    }
    
    public final Builder setMediaId(@Nullable String paramString)
    {
      this.a = paramString;
      return this;
    }
    
    public final Builder setMediaUri(@Nullable Uri paramUri)
    {
      this.h = paramUri;
      return this;
    }
    
    public final Builder setSubtitle(@Nullable CharSequence paramCharSequence)
    {
      this.c = paramCharSequence;
      return this;
    }
    
    public final Builder setTitle(@Nullable CharSequence paramCharSequence)
    {
      this.b = paramCharSequence;
      return this;
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/media/MediaDescriptionCompat.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */