MediaBrowserServiceCompatApi21.java 3.54 KB
package android.support.v4.media;

import android.annotation.TargetApi;
import android.content.Context;
import android.media.browse.MediaBrowser.MediaItem;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import android.service.media.MediaBrowserService;
import android.service.media.MediaBrowserService.BrowserRoot;
import android.service.media.MediaBrowserService.Result;
import android.support.annotation.RequiresApi;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@TargetApi(21)
@RequiresApi(21)
final class MediaBrowserServiceCompatApi21
{
  public static void a(Object paramObject, String paramString)
  {
    ((MediaBrowserService)paramObject).notifyChildrenChanged(paramString);
  }
  
  public static abstract interface ServiceCompatProxy
  {
    public abstract MediaBrowserServiceCompatApi21.a onGetRoot(String paramString, int paramInt, Bundle paramBundle);
    
    public abstract void onLoadChildren(String paramString, MediaBrowserServiceCompatApi21.c<List<Parcel>> paramc);
  }
  
  static final class a
  {
    final String a;
    final Bundle b;
    
    a(String paramString, Bundle paramBundle)
    {
      this.a = paramString;
      this.b = paramBundle;
    }
  }
  
  static class b
    extends MediaBrowserService
  {
    final MediaBrowserServiceCompatApi21.ServiceCompatProxy a;
    
    b(Context paramContext, MediaBrowserServiceCompatApi21.ServiceCompatProxy paramServiceCompatProxy)
    {
      attachBaseContext(paramContext);
      this.a = paramServiceCompatProxy;
    }
    
    public MediaBrowserService.BrowserRoot onGetRoot(String paramString, int paramInt, Bundle paramBundle)
    {
      paramString = this.a.onGetRoot(paramString, paramInt, paramBundle);
      if (paramString == null) {
        return null;
      }
      return new MediaBrowserService.BrowserRoot(paramString.a, paramString.b);
    }
    
    public void onLoadChildren(String paramString, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> paramResult)
    {
      this.a.onLoadChildren(paramString, new MediaBrowserServiceCompatApi21.c(paramResult));
    }
  }
  
  static final class c<T>
  {
    MediaBrowserService.Result a;
    
    c(MediaBrowserService.Result paramResult)
    {
      this.a = paramResult;
    }
    
    public final void a(T paramT)
    {
      Iterator localIterator = null;
      if ((paramT instanceof List))
      {
        MediaBrowserService.Result localResult = this.a;
        Object localObject = (List)paramT;
        if (localObject == null) {
          paramT = localIterator;
        }
        for (;;)
        {
          localResult.sendResult(paramT);
          return;
          paramT = new ArrayList();
          localIterator = ((List)localObject).iterator();
          while (localIterator.hasNext())
          {
            localObject = (Parcel)localIterator.next();
            ((Parcel)localObject).setDataPosition(0);
            paramT.add(MediaBrowser.MediaItem.CREATOR.createFromParcel((Parcel)localObject));
            ((Parcel)localObject).recycle();
          }
        }
      }
      if ((paramT instanceof Parcel))
      {
        paramT = (Parcel)paramT;
        paramT.setDataPosition(0);
        this.a.sendResult(MediaBrowser.MediaItem.CREATOR.createFromParcel(paramT));
        paramT.recycle();
        return;
      }
      this.a.sendResult(null);
    }
  }
}


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