package com.google.android.m4b.maps.bu;

import android.content.Context;
import android.content.res.Resources;
import android.location.Location;
import android.os.RemoteException;
import android.view.View;
import android.view.View.OnClickListener;
import com.google.android.m4b.maps.R.string;
import com.google.android.m4b.maps.ak.h;
import com.google.android.m4b.maps.j.d;
import com.google.android.m4b.maps.model.CameraPosition;
import com.google.android.m4b.maps.model.CameraPosition.Builder;
import com.google.android.m4b.maps.model.LatLng;
import com.google.android.m4b.maps.model.LatLngBounds;
import com.google.android.m4b.maps.model.RuntimeRemoteException;
import com.google.android.m4b.maps.r.q.a;
import com.google.android.m4b.maps.r.y;
import com.google.android.m4b.maps.r.z;
import com.google.common.base.Preconditions;

public final class be extends q.a
  implements View.OnClickListener
{
  private final j a;
  private final com.google.android.m4b.maps.r.j b;
  private final bd c;
  private final Context d;
  private final Resources e;
  private final a f;
  private Location g;
  private com.google.android.m4b.maps.r.j h;
  private final cb i;
  private boolean j;
  private boolean k;
  private z l;
  private y m;
  private boolean n;

  public be(Context paramContext, Resources paramResources, j paramj, bd parambd, a parama, com.google.android.m4b.maps.r.j paramj1, cb paramcb, boolean paramBoolean)
  {
    this.d = ((Context)Preconditions.checkNotNull(paramContext));
    this.a = ((j)Preconditions.checkNotNull(paramj));
    this.c = ((bd)Preconditions.checkNotNull(parambd));
    this.f = ((a)Preconditions.checkNotNull(parama));
    this.b = ((com.google.android.m4b.maps.r.j)Preconditions.checkNotNull(paramj1));
    this.h = ((com.google.android.m4b.maps.r.j)Preconditions.checkNotNull(paramj1));
    this.i = ((cb)Preconditions.checkNotNull(paramcb));
    this.e = ((Resources)Preconditions.checkNotNull(paramResources));
    this.k = true;
    this.n = paramBoolean;
  }

  private float a(LatLng paramLatLng, float paramFloat)
  {
    float f1 = this.a.c().zoom;
    if (f1 <= 10.0F)
      f1 = 15.0F;
    j localj = this.a;
    double d1 = paramFloat;
    double d2 = q.a(d1);
    double d3 = q.a(paramLatLng, d1);
    double d4 = d2 + paramLatLng.latitude;
    double d5 = paramLatLng.latitude - d2;
    double d6 = d3 + paramLatLng.longitude;
    float f2 = localj.a(new LatLngBounds(new LatLng(d5, paramLatLng.longitude - d3), new LatLng(d4, d6))).zoom;
    if (f2 == -1.0F)
      return f1;
    return Math.min(f1, f2);
  }

  private void f()
  {
    boolean bool;
    bd localbd;
    if ((this.k) && (this.j))
    {
      bool = true;
      this.c.a(bool);
      localbd = this.c;
      if (!bool)
        break label44;
    }
    while (true)
    {
      localbd.a(this);
      return;
      bool = false;
      break;
      label44: this = null;
    }
  }

  public final void a()
  {
    if (this.j);
    while (true)
    {
      return;
      this.j = true;
      this.f.a();
      try
      {
        this.h.a(this);
        f();
        if (this.g == null)
          continue;
        a(this.g);
        return;
      }
      catch (RemoteException localRemoteException)
      {
        throw new RuntimeRemoteException(localRemoteException);
      }
    }
  }

  public final void a(Location paramLocation)
  {
    this.f.a(paramLocation);
    if (this.l != null);
    try
    {
      Location localLocation = new Location(paramLocation);
      if (this.n)
        this.l.a(localLocation);
      while (true)
      {
        this.g = paramLocation;
        return;
        this.l.a(d.a(localLocation));
      }
    }
    catch (RemoteException localRemoteException)
    {
      throw new RuntimeRemoteException(localRemoteException);
    }
  }

  public final void a(com.google.android.m4b.maps.j.b paramb)
  {
    a((Location)d.a(paramb));
  }

  // ERROR //
  public final void a(com.google.android.m4b.maps.r.j paramj)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 126	com/google/android/m4b/maps/bu/be:j	Z
    //   4: ifeq +12 -> 16
    //   7: aload_0
    //   8: getfield 64	com/google/android/m4b/maps/bu/be:h	Lcom/google/android/m4b/maps/r/j;
    //   11: invokeinterface 174 1 0
    //   16: aload_1
    //   17: ifnull +36 -> 53
    //   20: aload_0
    //   21: aload_1
    //   22: putfield 64	com/google/android/m4b/maps/bu/be:h	Lcom/google/android/m4b/maps/r/j;
    //   25: aload_0
    //   26: getfield 126	com/google/android/m4b/maps/bu/be:j	Z
    //   29: ifeq +13 -> 42
    //   32: aload_0
    //   33: getfield 64	com/google/android/m4b/maps/bu/be:h	Lcom/google/android/m4b/maps/r/j;
    //   36: aload_0
    //   37: invokeinterface 139 2 0
    //   42: return
    //   43: astore_3
    //   44: new 148	com/google/android/m4b/maps/model/RuntimeRemoteException
    //   47: dup
    //   48: aload_3
    //   49: invokespecial 151	com/google/android/m4b/maps/model/RuntimeRemoteException:<init>	(Landroid/os/RemoteException;)V
    //   52: athrow
    //   53: aload_0
    //   54: getfield 62	com/google/android/m4b/maps/bu/be:b	Lcom/google/android/m4b/maps/r/j;
    //   57: astore_1
    //   58: goto -38 -> 20
    //   61: astore_2
    //   62: new 148	com/google/android/m4b/maps/model/RuntimeRemoteException
    //   65: dup
    //   66: aload_2
    //   67: invokespecial 151	com/google/android/m4b/maps/model/RuntimeRemoteException:<init>	(Landroid/os/RemoteException;)V
    //   70: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   7	16	43	android/os/RemoteException
    //   32	42	61	android/os/RemoteException
  }

  public final void a(y paramy)
  {
    this.m = paramy;
  }

  @Deprecated
  public final void a(z paramz)
  {
    this.l = paramz;
  }

  public final void a(boolean paramBoolean)
  {
    if (this.k != paramBoolean)
    {
      this.k = paramBoolean;
      f();
    }
  }

  public final void b()
  {
    if (!this.j)
      return;
    this.j = false;
    f();
    try
    {
      this.h.a();
      this.f.b();
      return;
    }
    catch (RemoteException localRemoteException)
    {
      throw new RuntimeRemoteException(localRemoteException);
    }
  }

  public final boolean c()
  {
    return this.j;
  }

  public final boolean d()
  {
    return this.k;
  }

  @Deprecated
  public final Location e()
  {
    Preconditions.checkState(this.j, "MyLocation layer not enabled");
    return this.g;
  }

  public final void onClick(final View paramView)
  {
    this.i.a(cb.a.bh);
    if (this.m != null);
    do
    {
      try
      {
        boolean bool = this.m.a();
        if (bool)
          return;
      }
      catch (RemoteException localRemoteException)
      {
        throw new RuntimeRemoteException(localRemoteException);
      }
      Preconditions.checkState(this.j, "MyLocation layer not enabled");
      if (this.g != null)
      {
        LatLng localLatLng1 = new LatLng(this.g.getLatitude(), this.g.getLongitude());
        float f1 = a(localLatLng1, this.g.getAccuracy());
        CameraPosition localCameraPosition = CameraPosition.builder(this.a.c()).target(localLatLng1).zoom(f1).build();
        this.a.a(localCameraPosition, -1);
      }
    }
    while ((!b.a(this.d)) || (this.g == null));
    LatLng localLatLng2 = new LatLng(this.g.getLatitude(), this.g.getLongitude());
    bn localbn = new bn(localLatLng2, a(localLatLng2, this.g.getAccuracy()));
    localbn.a(new bn.a()
    {
      public final void a(bn paramAnonymousbn)
      {
        if (paramAnonymousbn.j() > 0)
        {
          bn.b localb = paramAnonymousbn.a(0);
          String str = be.a(be.this).getString(R.string.YOUR_LOCATION) + ": " + localb.a();
          b.a(paramView, str);
        }
      }
    });
    h.a().c(localbn);
  }

  public static abstract interface a
  {
    public abstract void a();

    public abstract void a(Location paramLocation);

    public abstract void b();
  }
}

/* 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.bu.be
 * JD-Core Version:    0.6.2
 */