package com.google.android.m4b.maps.bv;

import android.content.res.Resources;
import android.os.Handler;
import android.os.RemoteException;
import android.util.DisplayMetrics;
import com.google.android.m4b.maps.bu.bx;
import com.google.android.m4b.maps.bu.cb;
import com.google.android.m4b.maps.bu.j;
import com.google.android.m4b.maps.bu.j.a;
import com.google.android.m4b.maps.model.CameraPosition;
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.n;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.math.DoubleMath;
import java.util.Collection;
import java.util.Iterator;

public final class c
  implements j
{
  private final e b;
  private final double c;
  private CameraPosition d = b(new CameraPosition(new LatLng(0.0D, 0.0D), 3.0F, 0.0F, 0.0F));
  private n e;
  private Collection<n> f;
  private int g;
  private int h;
  private int i;
  private int j;

  public c(e parame, Resources paramResources, Handler paramHandler)
  {
    this.b = parame;
    this.c = Math.max(1.0D, Math.floor(paramResources.getDisplayMetrics().density));
  }

  private void a(CameraPosition paramCameraPosition)
  {
    this.d = b(paramCameraPosition);
    this.b.d();
    if (this.f != null)
    {
      Iterator localIterator = this.f.iterator();
      while (localIterator.hasNext())
      {
        n localn = (n)localIterator.next();
        try
        {
          localn.a(this.d);
        }
        catch (RemoteException localRemoteException2)
        {
          throw new RuntimeRemoteException(localRemoteException2);
        }
      }
    }
    if (this.e != null);
    try
    {
      this.e.a(this.d);
      return;
    }
    catch (RemoteException localRemoteException1)
    {
      throw new RuntimeRemoteException(localRemoteException1);
    }
  }

  private static CameraPosition b(CameraPosition paramCameraPosition)
  {
    if ((paramCameraPosition.tilt != 0.0F) || (paramCameraPosition.bearing != 0.0F))
      bx.a(5, "Non zero bearing and tilt are not supported in Lite Mode");
    if (!DoubleMath.isMathematicalInteger(paramCameraPosition.zoom))
      bx.a(5, "Non integer zooms are not supported in Lite Mode");
    int k = Math.round(Math.max(0.0F, Math.min(22.0F, paramCameraPosition.zoom)));
    return new CameraPosition(paramCameraPosition.target, k, 0.0F, 0.0F);
  }

  public final float a(LatLng paramLatLng)
  {
    return 22.0F;
  }

  public final CameraPosition a(LatLngBounds paramLatLngBounds)
  {
    int k = this.b.getWidth();
    int m = this.b.getHeight();
    double d1 = this.c;
    paramLatLngBounds.getCenter();
    double d2 = 22.0F;
    k.a locala1 = k.a(paramLatLngBounds.southwest, d2, d1);
    k.a locala2 = k.a(paramLatLngBounds.northeast, d2, d1);
    if (paramLatLngBounds.southwest.longitude > paramLatLngBounds.northeast.longitude);
    for (k.a locala3 = new k.a(locala2.a + (int)k.a(d2, d1), locala2.b); ; locala3 = locala2)
    {
      long l1 = locala3.a - locala1.a;
      for (long l2 = locala1.b - locala3.b; (l1 > k) || (l2 > m); l2 >>= 1)
      {
        d2 -= 1.0D;
        l1 >>= 1;
      }
      return new CameraPosition(paramLatLngBounds.getCenter(), (float)d2, 0.0F, 0.0F);
    }
  }

  public final void a()
  {
  }

  public final void a(float paramFloat1, float paramFloat2, int paramInt)
  {
    bx.a(5, "scrollBy is not supported in Lite Mode");
  }

  public final void a(float paramFloat, int paramInt)
  {
    a(new CameraPosition(this.d.target, paramFloat + this.d.zoom, this.d.tilt, this.d.bearing));
  }

  public final void a(float paramFloat, int paramInt1, int paramInt2, int paramInt3)
  {
    bx.a(5, "zoomBy with focus is not supported in Lite Mode");
  }

  public final void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this.g = paramInt1;
    this.h = paramInt2;
    this.i = paramInt3;
    this.j = paramInt4;
  }

  public final void a(j.a parama, int paramInt, com.google.android.m4b.maps.r.e parame, cb paramcb)
  {
    if ((paramInt != 0) || (parame == null));
    for (boolean bool = true; ; bool = false)
    {
      Preconditions.checkArgument(bool, "Callback supplied with instantaneous camera movement");
      Preconditions.checkState(true, "Camera moved during a cancellation");
      parama.a(this, paramInt, paramcb);
      return;
    }
  }

  public final void a(CameraPosition paramCameraPosition, int paramInt)
  {
    a(paramCameraPosition);
  }

  public final void a(LatLng paramLatLng, float paramFloat, int paramInt)
  {
    a(new CameraPosition(paramLatLng, paramFloat, this.d.tilt, this.d.bearing));
  }

  public final void a(LatLng paramLatLng, int paramInt)
  {
    a(new CameraPosition(paramLatLng, this.d.zoom, this.d.tilt, this.d.bearing));
  }

  public final void a(LatLngBounds paramLatLngBounds, int paramInt1, int paramInt2)
  {
    a(a(paramLatLngBounds));
  }

  public final void a(LatLngBounds paramLatLngBounds, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    bx.a(5, "newLatLngBounds with size is not supported in Lite Mode");
  }

  public final void a(n paramn)
  {
    this.e = paramn;
  }

  public final k b()
  {
    return new k(this.d, this.b.getWidth(), this.b.getHeight(), this.c, this.g, this.h, this.i, this.j);
  }

  public final void b(float paramFloat, int paramInt)
  {
    bx.a(5, "zoomByCumulative is not supported in Lite Mode");
  }

  public final void b(n paramn)
  {
    if (this.f == null)
      this.f = Lists.newArrayList();
    this.f.add(paramn);
  }

  public final CameraPosition c()
  {
    return this.d;
  }

  public final void c(float paramFloat, int paramInt)
  {
    a(new CameraPosition(this.d.target, paramFloat, this.d.tilt, this.d.bearing));
  }

  public final void c(n paramn)
  {
    this.f.remove(paramn);
    if (this.f.isEmpty())
      this.f = null;
  }

  public final float d()
  {
    return 0.0F;
  }
}

/* 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.bv.c
 * JD-Core Version:    0.6.2
 */