package com.google.android.m4b.maps.bi;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;

public final class a
{
  private final ArrayList<b> a = new ArrayList();
  private int b = 0;
  private boolean c;
  private byte[] d;
  private WeakReference<Bitmap> e;
  private final CountDownLatch f = new CountDownLatch(1);
  private long g;
  private long h = -1L;

  public final void a(long paramLong)
  {
    this.h = paramLong;
  }

  final void a(b paramb)
  {
    synchronized (this.a)
    {
      this.a.add(paramb);
      return;
    }
  }

  public final void a(boolean paramBoolean)
  {
    this.c = paramBoolean;
  }

  public final boolean a()
  {
    return this.c;
  }

  public final boolean a(com.google.android.m4b.maps.ac.a parama)
  {
    int i = parama.d(3);
    String str1 = parama.h(7);
    if ((i == 200) && (str1 != null))
    {
      this.g = parama.e(4);
      String str2 = str1.toLowerCase();
      if (str2.startsWith("image/"))
      {
        this.d = parama.c(6);
        this.b = 2;
      }
      while (this.b != 1)
      {
        return true;
        if (str2.equals("application/binary"))
        {
          this.d = parama.c(6);
          this.b = 3;
        }
        else
        {
          this.b = 1;
        }
      }
      return false;
    }
    if (i != 304)
      this.b = 1;
    return false;
  }

  public final boolean b()
  {
    return (this.b != 0) && (this.b != 1);
  }

  public final Bitmap c()
  {
    Bitmap localBitmap;
    if (this.e != null)
      localBitmap = (Bitmap)this.e.get();
    while (true)
    {
      if ((localBitmap == null) && (this.b == 2) && (this.d != null));
      try
      {
        if (this.e != null);
        for (localBitmap = (Bitmap)this.e.get(); ; localBitmap = null)
        {
          if ((localBitmap == null) && (this.d != null))
          {
            BitmapFactory.Options localOptions = new BitmapFactory.Options();
            localOptions.inPurgeable = true;
            localOptions.inInputShareable = true;
            localBitmap = BitmapFactory.decodeByteArray(this.d, 0, this.d.length, localOptions);
            if (localBitmap == null)
            {
              this.b = 1;
              this.d = null;
            }
            this.e = new WeakReference(localBitmap);
          }
          return localBitmap;
          localBitmap = null;
          break;
        }
      }
      finally
      {
      }
    }
  }

  public final byte[] d()
  {
    if (this.b == 3)
      return this.d;
    return null;
  }

  public final long e()
  {
    return this.g;
  }

  public final long f()
  {
    return this.h;
  }

  final void g()
  {
    ArrayList localArrayList = this.a;
    int i = 0;
    try
    {
      while (i < this.a.size())
      {
        ((b)this.a.get(i)).a(this);
        i++;
      }
      this.a.clear();
      this.f.countDown();
      return;
    }
    finally
    {
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.bi.a
 * JD-Core Version:    0.6.2
 */