package com.google.android.m4b.maps.az;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;

public final class g
{
  private static final int f = ViewConfiguration.getLongPressTimeout();
  private static final int g = ViewConfiguration.getTapTimeout();
  private static final int h = ViewConfiguration.getDoubleTapTimeout();
  private int a;
  private int b;
  private int c;
  private int d;
  private int e;
  private final Handler i;
  private final GestureDetector.OnGestureListener j;
  private GestureDetector.OnDoubleTapListener k;
  private boolean l;
  private boolean m;
  private boolean n;
  private boolean o;
  private MotionEvent p;
  private MotionEvent q;
  private boolean r;
  private float s;
  private float t;
  private float u;
  private float v;
  private boolean w;
  private VelocityTracker x;

  public g(Context paramContext, GestureDetector.OnGestureListener paramOnGestureListener, Handler paramHandler)
  {
    this.i = new a(paramHandler);
    this.j = paramOnGestureListener;
    if ((paramOnGestureListener instanceof GestureDetector.OnDoubleTapListener))
      this.k = ((GestureDetector.OnDoubleTapListener)paramOnGestureListener);
    if (this.j == null)
      throw new NullPointerException("OnGestureListener must not be null");
    this.w = true;
    int i2;
    int i3;
    int i1;
    if (paramContext == null)
    {
      i2 = ViewConfiguration.getTouchSlop();
      i3 = i2 * 2;
      this.d = ViewConfiguration.getMinimumFlingVelocity();
      this.e = ViewConfiguration.getMaximumFlingVelocity();
      i1 = i2;
    }
    while (true)
    {
      this.a = (i1 * i1);
      this.b = (i2 * i2);
      this.c = (i3 * i3);
      return;
      ViewConfiguration localViewConfiguration = ViewConfiguration.get(paramContext);
      i1 = localViewConfiguration.getScaledTouchSlop();
      i2 = localViewConfiguration.getScaledTouchSlop();
      i3 = localViewConfiguration.getScaledDoubleTapSlop();
      this.d = localViewConfiguration.getScaledMinimumFlingVelocity();
      this.e = localViewConfiguration.getScaledMaximumFlingVelocity();
    }
  }

  public final void a(GestureDetector.OnDoubleTapListener paramOnDoubleTapListener)
  {
    this.k = paramOnDoubleTapListener;
  }

  public final void a(boolean paramBoolean)
  {
    this.w = true;
  }

  public final boolean a(MotionEvent paramMotionEvent)
  {
    int i1 = paramMotionEvent.getAction();
    if (this.x == null)
      this.x = VelocityTracker.obtain();
    this.x.addMovement(paramMotionEvent);
    int i2;
    if ((i1 & 0xFF) == 6)
    {
      i2 = 1;
      if (i2 == 0)
        break label111;
    }
    int i4;
    float f1;
    float f2;
    label111: for (int i3 = paramMotionEvent.getActionIndex(); ; i3 = -1)
    {
      i4 = paramMotionEvent.getPointerCount();
      int i5 = 0;
      f1 = 0.0F;
      f2 = 0.0F;
      while (i5 < i4)
      {
        if (i3 != i5)
        {
          f2 += paramMotionEvent.getX(i5);
          f1 += paramMotionEvent.getY(i5);
        }
        i5++;
      }
      i2 = 0;
      break;
    }
    int i6;
    float f3;
    float f4;
    if (i2 != 0)
    {
      i6 = i4 - 1;
      f3 = f2 / i6;
      f4 = f1 / i6;
    }
    label744: float f7;
    float f8;
    int i10;
    boolean bool3;
    switch (i1 & 0xFF)
    {
    case 4:
    default:
    case 5:
      do
      {
        return false;
        i6 = i4;
        break;
        this.s = f3;
        this.u = f3;
        this.t = f4;
        this.v = f4;
        this.i.removeMessages(1);
        this.i.removeMessages(2);
        this.i.removeMessages(3);
        this.r = false;
        this.n = false;
        this.o = false;
      }
      while (!this.m);
      this.m = false;
      return false;
    case 6:
      this.s = f3;
      this.u = f3;
      this.t = f4;
      this.v = f4;
      this.x.computeCurrentVelocity(1000, this.e);
      int i14 = paramMotionEvent.getActionIndex();
      int i15 = paramMotionEvent.getPointerId(i14);
      float f9 = this.x.getXVelocity(i15);
      float f10 = this.x.getYVelocity(i15);
      for (int i16 = 0; i16 < i4; i16++)
        if (i16 != i14)
        {
          int i17 = paramMotionEvent.getPointerId(i16);
          if (f9 * this.x.getXVelocity(i17) + f10 * this.x.getYVelocity(i17) < 0.0F)
          {
            this.x.clear();
            return false;
          }
        }
    case 0:
      int i11;
      if (this.k != null)
      {
        boolean bool5 = this.i.hasMessages(3);
        if (bool5)
          this.i.removeMessages(3);
        if ((this.p != null) && (this.q != null) && (bool5))
        {
          MotionEvent localMotionEvent2 = this.p;
          MotionEvent localMotionEvent3 = this.q;
          if ((this.o) && (paramMotionEvent.getEventTime() - localMotionEvent3.getEventTime() <= h))
          {
            int i12 = (int)localMotionEvent2.getX() - (int)paramMotionEvent.getX();
            int i13 = (int)localMotionEvent2.getY() - (int)paramMotionEvent.getY();
            if (i12 * i12 + i13 * i13 < this.c)
            {
              i11 = 1;
              if (i11 == 0)
                break label744;
              this.r = true;
            }
          }
        }
      }
      for (boolean bool4 = false | this.k.onDoubleTap(this.p) | this.k.onDoubleTapEvent(paramMotionEvent); ; bool4 = false)
      {
        this.s = f3;
        this.u = f3;
        this.t = f4;
        this.v = f4;
        if (this.p != null)
          this.p.recycle();
        this.p = MotionEvent.obtain(paramMotionEvent);
        this.n = true;
        this.o = true;
        this.l = true;
        this.m = false;
        if (this.w)
        {
          this.i.removeMessages(2);
          this.i.sendEmptyMessageAtTime(2, this.p.getDownTime() + g + f);
        }
        this.i.sendEmptyMessageAtTime(1, this.p.getDownTime() + g);
        return bool4 | this.j.onDown(paramMotionEvent);
        i11 = 0;
        break;
        this.i.sendEmptyMessageDelayed(3, h);
      }
    case 2:
      f7 = this.s - f3;
      f8 = this.t - f4;
      if (this.r)
        return false | this.k.onDoubleTapEvent(paramMotionEvent);
      if (this.n)
      {
        int i8 = (int)(f3 - this.u);
        int i9 = (int)(f4 - this.v);
        i10 = i8 * i8 + i9 * i9;
        if (i10 <= this.a)
          break label1306;
        bool3 = this.j.onScroll(this.p, paramMotionEvent, f7, f8);
        this.s = f3;
        this.t = f4;
        this.n = false;
        this.i.removeMessages(3);
        this.i.removeMessages(1);
        this.i.removeMessages(2);
      }
      break;
    case 1:
    case 3:
    }
    while (true)
    {
      if (i10 > this.b)
        this.o = false;
      return bool3;
      if ((Math.abs(f7) < 1.0F) && (Math.abs(f8) < 1.0F))
        break;
      boolean bool2 = this.j.onScroll(this.p, paramMotionEvent, f7, f8);
      this.s = f3;
      this.t = f4;
      return bool2;
      this.l = false;
      MotionEvent localMotionEvent1 = MotionEvent.obtain(paramMotionEvent);
      boolean bool1;
      if (this.r)
        bool1 = false | this.k.onDoubleTapEvent(paramMotionEvent);
      while (true)
      {
        if (this.q != null)
          this.q.recycle();
        this.q = localMotionEvent1;
        if (this.x != null)
        {
          this.x.recycle();
          this.x = null;
        }
        this.r = false;
        this.i.removeMessages(1);
        this.i.removeMessages(2);
        return bool1;
        if (this.m)
        {
          this.i.removeMessages(3);
          this.m = false;
          bool1 = this.j.onSingleTapUp(paramMotionEvent);
        }
        else if (this.n)
        {
          bool1 = this.j.onSingleTapUp(paramMotionEvent);
        }
        else
        {
          VelocityTracker localVelocityTracker = this.x;
          int i7 = paramMotionEvent.getPointerId(0);
          localVelocityTracker.computeCurrentVelocity(1000, this.e);
          float f5 = localVelocityTracker.getYVelocity(i7);
          float f6 = localVelocityTracker.getXVelocity(i7);
          if ((Math.abs(f5) > this.d) || (Math.abs(f6) > this.d))
          {
            bool1 = this.j.onFling(this.p, paramMotionEvent, f6, f5);
            continue;
            this.i.removeMessages(1);
            this.i.removeMessages(2);
            this.i.removeMessages(3);
            this.x.recycle();
            this.x = null;
            this.r = false;
            this.l = false;
            this.n = false;
            this.o = false;
            if (!this.m)
              break;
            this.m = false;
            return false;
          }
          bool1 = false;
        }
      }
      label1306: bool3 = false;
    }
  }

  final class a extends Handler
  {
    a(Handler arg2)
    {
      super();
    }

    public final void handleMessage(Message paramMessage)
    {
      switch (paramMessage.what)
      {
      default:
        throw new RuntimeException("Unknown message " + paramMessage);
      case 1:
        g.b(g.this).onShowPress(g.a(g.this));
      case 2:
      case 3:
      }
      do
      {
        return;
        g.c(g.this);
        return;
      }
      while ((g.d(g.this) == null) || (g.e(g.this)));
      g.d(g.this).onSingleTapConfirmed(g.a(g.this));
    }
  }
}

/* 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.g
 * JD-Core Version:    0.6.2
 */