package com.google.android.m4b.maps.az;

import android.content.Context;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import com.google.android.m4b.maps.ak.r;
import com.google.common.collect.Lists;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public final class i
{
  private float A;
  private float B;
  private float C;
  private boolean D;
  private boolean E;
  private boolean F;
  private boolean G;
  private g H;
  private Context a;
  private MotionEvent b;
  private MotionEvent c;
  private final List<e> d = Lists.newArrayList();
  private final List<e> e = Lists.newArrayList();
  private final e f;
  private final e g;
  private final e h;
  private final LinkedList<h> i = new LinkedList();
  private long j;
  private float k;
  private float l;
  private float m;
  private float n;
  private float o;
  private float p;
  private float q;
  private float r;
  private float s;
  private float t;
  private float u;
  private float v;
  private float w;
  private float x;
  private float y;
  private float z;

  public i(Context paramContext, b paramb)
  {
    ViewConfiguration localViewConfiguration = ViewConfiguration.get(paramContext);
    this.a = paramContext;
    this.A = localViewConfiguration.getScaledEdgeSlop();
    List localList1 = this.d;
    q localq = new q(paramb);
    this.g = localq;
    localList1.add(localq);
    if (com.google.android.m4b.maps.ak.e.e().n())
    {
      List localList4 = this.d;
      k localk = new k(paramb);
      this.h = localk;
      localList4.add(localk);
      r.a("MD", "T");
    }
    while (true)
    {
      List localList3 = this.d;
      m localm = new m(paramb);
      this.f = localm;
      localList3.add(localm);
      this.d.add(new s(paramb));
      this.H = new g(paramContext, paramb, new Handler(Looper.getMainLooper()));
      this.H.a(true);
      this.H.a(paramb);
      return;
      List localList2 = this.d;
      o localo = new o(paramb);
      this.h = localo;
      localList2.add(localo);
      r.a("MD", "F");
    }
  }

  private static float a(MotionEvent paramMotionEvent, int paramInt)
  {
    return paramMotionEvent.getRawX() - paramMotionEvent.getX() + paramMotionEvent.getX(paramInt);
  }

  private void a(MotionEvent paramMotionEvent, StringBuilder paramStringBuilder)
  {
    boolean bool1 = true;
    int i1 = paramMotionEvent.getAction();
    if (this.i.isEmpty())
      this.j = paramMotionEvent.getEventTime();
    this.i.addLast(new a(paramMotionEvent));
    if (this.i.size() > 20)
      ((h)this.i.removeFirst()).e();
    long l1 = ((h)this.i.getFirst()).a();
    if (((h)this.i.getLast()).a() - l1 >= 250L);
    for (boolean bool2 = bool1; ; bool2 = false)
    {
      if ((!bool2) || (this.i.size() <= 3))
        break label145;
      ((h)this.i.removeFirst()).e();
      break;
    }
    label145: Iterator localIterator;
    switch (i1)
    {
    default:
      bool1 = false;
    case 1:
    case 6:
    case 262:
      if (this.G)
        localIterator = this.d.iterator();
      break;
    case 3:
    }
    while (true)
    {
      e locale;
      if (localIterator.hasNext())
      {
        locale = (e)localIterator.next();
        if (locale.a());
      }
      else
      {
        switch (1.a[locale.a(this.j, this.i, bool1, this.e, null).ordinal()])
        {
        case 1:
        default:
          break;
        case 2:
          if (bool1)
          {
            g();
            this.G = false;
          }
          return;
          this.G = false;
          break;
        case 3:
          if (locale.a(this))
            this.e.add(locale);
          break;
        }
      }
    }
  }

  private static boolean a(e parame)
  {
    return (parame != null) && (parame.a());
  }

  private static float b(MotionEvent paramMotionEvent, int paramInt)
  {
    return paramMotionEvent.getRawY() - paramMotionEvent.getY() + paramMotionEvent.getY(paramInt);
  }

  private void b(MotionEvent paramMotionEvent)
  {
    this.c = MotionEvent.obtain(paramMotionEvent);
    this.r = -1.0F;
    this.s = -1.0F;
    this.v = -1.0F;
    this.w = 0.0F;
    this.E = false;
    this.F = false;
    MotionEvent localMotionEvent = this.b;
    float f1 = localMotionEvent.getX(0);
    float f2 = localMotionEvent.getY(0);
    float f3 = localMotionEvent.getX(-1 + localMotionEvent.getPointerCount());
    float f4 = localMotionEvent.getY(-1 + localMotionEvent.getPointerCount());
    float f5 = paramMotionEvent.getX(0);
    float f6 = paramMotionEvent.getY(0);
    float f7 = paramMotionEvent.getX(-1 + paramMotionEvent.getPointerCount());
    float f8 = paramMotionEvent.getY(-1 + paramMotionEvent.getPointerCount());
    float f9 = f3 - f1;
    float f10 = f4 - f2;
    float f11 = f7 - f5;
    float f12 = f8 - f6;
    this.n = f9;
    this.o = f10;
    this.p = f11;
    this.q = f12;
    this.t = f2;
    this.u = f6;
    this.k = (f5 + f11 * 0.5F);
    this.l = (f6 + f12 * 0.5F);
    this.m = (f1 + f9 * 0.5F);
    paramMotionEvent.getEventTime();
    localMotionEvent.getEventTime();
    this.y = (paramMotionEvent.getPressure(0) + paramMotionEvent.getPressure(-1 + paramMotionEvent.getPointerCount()));
    this.z = (localMotionEvent.getPressure(0) + localMotionEvent.getPressure(-1 + localMotionEvent.getPointerCount()));
  }

  private void g()
  {
    Iterator localIterator = this.e.iterator();
    while (localIterator.hasNext())
      ((e)localIterator.next()).c(this);
  }

  private void h()
  {
    this.b = null;
    this.c = null;
    this.D = false;
    this.G = false;
    this.e.clear();
    Iterator localIterator1 = this.i.iterator();
    while (localIterator1.hasNext())
      ((h)localIterator1.next()).e();
    this.i.clear();
    Iterator localIterator2 = this.d.iterator();
    while (localIterator2.hasNext())
    {
      e locale = (e)localIterator2.next();
      if (locale.a())
        locale.c(this);
    }
  }

  public final float a()
  {
    return this.k;
  }

  public final boolean a(MotionEvent paramMotionEvent)
  {
    int i1 = paramMotionEvent.getAction();
    int i2 = (0xFF00 & i1) >> 8;
    int i5;
    int i6;
    if (!this.G)
      if ((i1 == 5) || (i1 == 261) || (i1 == 0))
      {
        DisplayMetrics localDisplayMetrics = this.a.getResources().getDisplayMetrics();
        this.B = (localDisplayMetrics.widthPixels - this.A);
        this.C = (localDisplayMetrics.heightPixels - this.A);
        h();
        this.b = MotionEvent.obtain(paramMotionEvent);
        b(paramMotionEvent);
        float f1 = this.A;
        float f2 = this.B;
        float f3 = this.C;
        float f4 = paramMotionEvent.getRawX();
        float f5 = paramMotionEvent.getRawY();
        float f6 = a(paramMotionEvent, -1 + paramMotionEvent.getPointerCount());
        float f7 = b(paramMotionEvent, -1 + paramMotionEvent.getPointerCount());
        if ((f4 < f1) || (f5 < f1) || (f4 > f2) || (f5 > f3))
        {
          i5 = 1;
          if ((f6 >= f1) && (f7 >= f1) && (f6 <= f2) && (f7 <= f3))
            break label266;
          i6 = 1;
          label220: if ((i5 == 0) || (i6 == 0))
            break label272;
          this.k = -1.0F;
          this.l = -1.0F;
          this.D = true;
        }
      }
    label266: label527: 
    while (true)
    {
      this.H.a(paramMotionEvent);
      return true;
      i5 = 0;
      break;
      i6 = 0;
      break label220;
      label272: if (i5 != 0)
      {
        this.k = paramMotionEvent.getX(-1 + paramMotionEvent.getPointerCount());
        this.l = paramMotionEvent.getY(-1 + paramMotionEvent.getPointerCount());
        this.D = true;
      }
      else if (i6 != 0)
      {
        this.k = paramMotionEvent.getX(0);
        this.l = paramMotionEvent.getY(0);
        this.D = true;
      }
      else
      {
        this.G = true;
        continue;
        if ((i1 == 2) && (this.D))
        {
          float f8 = this.A;
          float f9 = this.B;
          float f10 = this.C;
          float f11 = paramMotionEvent.getRawX();
          float f12 = paramMotionEvent.getRawY();
          float f13 = a(paramMotionEvent, -1 + paramMotionEvent.getPointerCount());
          float f14 = b(paramMotionEvent, -1 + paramMotionEvent.getPointerCount());
          int i8;
          if ((f11 < f8) || (f12 < f8) || (f11 > f9) || (f12 > f10))
          {
            i8 = 1;
            label453: if ((f13 >= f8) && (f14 >= f8) && (f13 <= f9) && (f14 <= f10))
              break label521;
          }
          for (int i9 = 1; ; i9 = 0)
          {
            if ((i8 == 0) || (i9 == 0))
              break label527;
            this.k = -1.0F;
            this.l = -1.0F;
            break;
            i8 = 0;
            break label453;
          }
          if (i8 != 0)
          {
            this.k = paramMotionEvent.getX(-1 + paramMotionEvent.getPointerCount());
            this.l = paramMotionEvent.getY(-1 + paramMotionEvent.getPointerCount());
          }
          else if (i9 != 0)
          {
            this.k = paramMotionEvent.getX(0);
            this.l = paramMotionEvent.getY(0);
          }
          else
          {
            this.D = false;
            this.G = true;
          }
        }
        else if (((i1 == 6) || (i1 == 262) || (i1 == 1)) && (this.D))
        {
          int i7 = 0;
          if (i2 == 0)
            i7 = -1 + paramMotionEvent.getPointerCount();
          this.k = paramMotionEvent.getX(i7);
          this.l = paramMotionEvent.getY(i7);
          continue;
          if (!this.e.isEmpty());
          for (int i3 = 1; ; i3 = 0)
          {
            if (i3 != 0)
              break label703;
            a(MotionEvent.obtain(paramMotionEvent), null);
            break;
          }
          switch (i1)
          {
          default:
            break;
          case 1:
          case 6:
          case 262:
            b(paramMotionEvent);
            int i4 = 0;
            if (i2 == 0)
              i4 = -1 + paramMotionEvent.getPointerCount();
            this.k = paramMotionEvent.getX(i4);
            this.l = paramMotionEvent.getY(i4);
            if (!this.D)
              g();
            h();
            break;
          case 3:
            if (!this.D)
              g();
            h();
            break;
          case 2:
            label703: b(paramMotionEvent);
            a(this.c, null);
            if (this.y / this.z > 0.67F)
            {
              Iterator localIterator = this.e.iterator();
              boolean bool = false;
              while (localIterator.hasNext())
                bool |= ((e)localIterator.next()).e(this);
              if (bool)
                this.b = MotionEvent.obtain(paramMotionEvent);
            }
            break;
          }
        }
      }
    }
  }

  public final float b()
  {
    return this.l;
  }

  public final float c()
  {
    return this.m;
  }

  public final float d()
  {
    if (!a(this.f));
    while (this.c.getPointerCount() != this.b.getPointerCount())
      return 1.0F;
    if (this.v == -1.0F)
    {
      if (this.r == -1.0F)
      {
        float f4 = this.p;
        float f5 = this.q;
        this.r = ((float)Math.sqrt(f4 * f4 + f5 * f5));
      }
      float f1 = this.r;
      if (this.s == -1.0F)
      {
        float f2 = this.n;
        float f3 = this.o;
        this.s = ((float)Math.sqrt(f2 * f2 + f3 * f3));
      }
      this.v = (f1 / this.s);
    }
    return this.v;
  }

  public final float e()
  {
    if (!a(this.g))
      return 0.0F;
    if (!this.E)
    {
      this.w = (0.25F * (this.u - this.t));
      this.E = true;
    }
    return this.w;
  }

  public final float f()
  {
    if (!a(this.h));
    while (this.c.getPointerCount() != this.b.getPointerCount())
      return 0.0F;
    if (!this.F)
    {
      float f1 = h.a(this.c.getX(0), this.c.getY(0), this.c.getX(-1 + this.c.getPointerCount()), this.c.getY(-1 + this.c.getPointerCount()));
      this.x = e.a(h.a(this.b.getX(0), this.b.getY(0), this.b.getX(-1 + this.b.getPointerCount()), this.b.getY(-1 + this.b.getPointerCount())), f1);
      this.F = true;
    }
    return this.x;
  }

  public static abstract interface a extends GestureDetector.OnDoubleTapListener, GestureDetector.OnGestureListener
  {
    public abstract boolean a(j paramj);

    public abstract boolean a(l paraml);

    public abstract boolean a(p paramp);
  }

  public static abstract interface b extends GestureDetector.OnDoubleTapListener, GestureDetector.OnGestureListener
  {
    public abstract boolean a(i parami);

    public abstract boolean a(i parami, boolean paramBoolean);

    public abstract boolean b(i parami);

    public abstract boolean b(i parami, boolean paramBoolean);

    public abstract void c(i parami);

    public abstract void c(i parami, boolean paramBoolean);

    public abstract boolean d(i parami);

    public abstract boolean e(i parami);

    public abstract void f(i parami);

    public abstract boolean g(i parami);

    public abstract boolean h(i parami);

    public abstract void i(i parami);
  }
}

/* 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.az.i
 * JD-Core Version:    0.6.2
 */