package com.viewpagerindicator;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.drawable.Drawable;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewConfiguration;

public class CirclePageIndicator extends View
  implements PageIndicator
{
  private static final int INVALID_POINTER = -1;
  private boolean mCentered;
  private int mCurrentPage;
  private float mGapBetweenCircles;
  private boolean mIsDragging;
  private float mLargeRadius;
  private ViewPager.OnPageChangeListener mListener;
  private int mOrientation;
  private float mPageOffset;
  private final Paint mPaintFill = new Paint(1);
  private final Paint mPaintPageFill = new Paint(1);
  private final Paint mPaintStroke = new Paint(1);
  private int mScrollState;
  private float mSmallRadius;
  private boolean mSnap;
  private int mSnapPage;
  private int mTouchSlop;
  private ViewPager mViewPager;

  public CirclePageIndicator(Context paramContext)
  {
    this(paramContext, null);
  }

  public CirclePageIndicator(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, R.attr.vpiCirclePageIndicatorStyle);
  }

  public CirclePageIndicator(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    if (isInEditMode())
      return;
    Resources localResources = getResources();
    int i = localResources.getColor(R.color.default_circle_indicator_page_color);
    int j = localResources.getColor(R.color.default_circle_indicator_fill_color);
    int k = localResources.getInteger(R.integer.default_circle_indicator_orientation);
    int m = localResources.getColor(R.color.default_circle_indicator_stroke_color);
    float f1 = localResources.getDimension(R.dimen.default_circle_indicator_stroke_width);
    float f2 = localResources.getDimension(R.dimen.default_circle_indicator_radius);
    boolean bool1 = localResources.getBoolean(R.bool.default_circle_indicator_centered);
    boolean bool2 = localResources.getBoolean(R.bool.default_circle_indicator_snap);
    TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.CirclePageIndicator, paramInt, 0);
    this.mCentered = localTypedArray.getBoolean(R.styleable.CirclePageIndicator_centered, bool1);
    this.mOrientation = localTypedArray.getInt(R.styleable.CirclePageIndicator_android_orientation, k);
    this.mPaintPageFill.setStyle(Paint.Style.FILL);
    this.mPaintPageFill.setColor(localTypedArray.getColor(R.styleable.CirclePageIndicator_pageColor, i));
    this.mPaintStroke.setStyle(Paint.Style.STROKE);
    this.mPaintStroke.setColor(localTypedArray.getColor(R.styleable.CirclePageIndicator_strokeColor, m));
    this.mPaintStroke.setStrokeWidth(localTypedArray.getDimension(R.styleable.CirclePageIndicator_strokeWidth, f1));
    this.mPaintFill.setStyle(Paint.Style.FILL);
    this.mPaintFill.setColor(localTypedArray.getColor(R.styleable.CirclePageIndicator_fillColor, j));
    this.mSmallRadius = localTypedArray.getDimension(R.styleable.CirclePageIndicator_smallRadius, f2);
    this.mLargeRadius = localTypedArray.getDimension(R.styleable.CirclePageIndicator_largeRadius, f2);
    this.mGapBetweenCircles = localTypedArray.getDimension(R.styleable.CirclePageIndicator_gapBetweenCircles, f2);
    this.mSnap = localTypedArray.getBoolean(R.styleable.CirclePageIndicator_snap, bool2);
    Drawable localDrawable = localTypedArray.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (localDrawable != null)
      setBackgroundDrawable(localDrawable);
    localTypedArray.recycle();
    this.mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(ViewConfiguration.get(paramContext));
  }

  private int measureLong(int paramInt)
  {
    int i = View.MeasureSpec.getMode(paramInt);
    int j = View.MeasureSpec.getSize(paramInt);
    int k;
    if ((i == 1073741824) || (this.mViewPager == null))
      k = j;
    do
    {
      return k;
      int m = this.mViewPager.getAdapter().getCount();
      k = (int)(1.0F + (getPaddingLeft() + getPaddingRight() + m * 2 * this.mSmallRadius + (m - 1) * this.mSmallRadius));
    }
    while (i != -2147483648);
    return Math.min(k, j);
  }

  private int measureShort(int paramInt)
  {
    int i = View.MeasureSpec.getMode(paramInt);
    int j = View.MeasureSpec.getSize(paramInt);
    int k;
    if (i == 1073741824)
      k = j;
    do
    {
      return k;
      k = (int)(1.0F + (2.0F * this.mLargeRadius + getPaddingTop() + getPaddingBottom()));
    }
    while (i != -2147483648);
    return Math.min(k, j);
  }

  public int getCurrentPage()
  {
    return this.mCurrentPage;
  }

  public int getFillColor()
  {
    return this.mPaintFill.getColor();
  }

  public float getGapBetweenCircles()
  {
    return this.mGapBetweenCircles;
  }

  public float getLargeRadius()
  {
    return this.mLargeRadius;
  }

  public int getOrientation()
  {
    return this.mOrientation;
  }

  public int getPageColor()
  {
    return this.mPaintPageFill.getColor();
  }

  public float getSmallRadius()
  {
    return this.mSmallRadius;
  }

  public int getStrokeColor()
  {
    return this.mPaintStroke.getColor();
  }

  public float getStrokeWidth()
  {
    return this.mPaintStroke.getStrokeWidth();
  }

  public boolean isCentered()
  {
    return this.mCentered;
  }

  public boolean isSnap()
  {
    return this.mSnap;
  }

  public void notifyDataSetChanged()
  {
    invalidate();
  }

  protected void onDraw(Canvas paramCanvas)
  {
    super.onDraw(paramCanvas);
    if (this.mViewPager == null);
    int i;
    do
    {
      return;
      i = this.mViewPager.getAdapter().getCount();
    }
    while (i == 0);
    if (this.mCurrentPage >= i)
    {
      setCurrentItem(i - 1);
      return;
    }
    int j;
    int k;
    int m;
    int n;
    float f2;
    float f3;
    float f4;
    float f5;
    int i1;
    label183: float f10;
    float f11;
    if (this.mOrientation == 0)
    {
      j = getWidth();
      k = getPaddingLeft();
      m = getPaddingRight();
      n = getPaddingTop();
      float f1 = this.mGapBetweenCircles + 2.0F * this.mSmallRadius;
      f2 = n + this.mSmallRadius;
      f3 = k + this.mSmallRadius;
      if (this.mCentered)
        f3 += (j - k - m) / 2.0F - f1 * i / 2.0F;
      f4 = this.mSmallRadius;
      if (this.mPaintStroke.getStrokeWidth() > 0.0F)
        f4 -= this.mPaintStroke.getStrokeWidth() / 2.0F;
      f5 = this.mGapBetweenCircles + 2.0F * f4;
      i1 = 0;
      if (i1 >= i)
        break label282;
      f10 = f3 + f5 * i1;
      if (this.mOrientation != 0)
        break label271;
      f11 = f10;
    }
    for (float f12 = f2; ; f12 = f10)
    {
      if (this.mPaintPageFill.getAlpha() > 0)
        paramCanvas.drawCircle(f11, f12, f4, this.mPaintPageFill);
      i1++;
      break label183;
      j = getHeight();
      k = getPaddingTop();
      m = getPaddingBottom();
      n = getPaddingLeft();
      break;
      label271: f11 = f2;
    }
    label282: int i2;
    float f6;
    float f7;
    float f8;
    label340: float f9;
    if (this.mSnap)
    {
      i2 = this.mSnapPage;
      f6 = f5 * i2;
      if (!this.mSnap)
        f6 += f5 * this.mPageOffset;
      if (this.mOrientation != 0)
        break label387;
      f7 = f3 + f6;
      f8 = f2;
      if (this.mPageOffset <= 0.5D)
        break label401;
      f9 = this.mLargeRadius * this.mPageOffset;
    }
    while (true)
    {
      paramCanvas.drawCircle(f7, f8, f9, this.mPaintFill);
      return;
      i2 = this.mCurrentPage;
      break;
      label387: f7 = f2;
      f8 = f3 + f6;
      break label340;
      label401: boolean bool = this.mPageOffset < 0.5D;
      f9 = 0.0F;
      if (!bool)
        f9 = this.mLargeRadius * (1.0F - this.mPageOffset);
    }
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    if (this.mOrientation == 0)
    {
      setMeasuredDimension(measureLong(paramInt1), measureShort(paramInt2));
      return;
    }
    setMeasuredDimension(measureShort(paramInt1), measureLong(paramInt2));
  }

  public void onPageScrollStateChanged(int paramInt)
  {
    this.mScrollState = paramInt;
    if (this.mListener != null)
      this.mListener.onPageScrollStateChanged(paramInt);
  }

  public void onPageScrolled(int paramInt1, float paramFloat, int paramInt2)
  {
    this.mCurrentPage = paramInt1;
    this.mPageOffset = paramFloat;
    invalidate();
    if (this.mListener != null)
      this.mListener.onPageScrolled(paramInt1, paramFloat, paramInt2);
  }

  public void onPageSelected(int paramInt)
  {
    if ((this.mSnap) || (this.mScrollState == 0))
    {
      this.mCurrentPage = paramInt;
      this.mSnapPage = paramInt;
      invalidate();
    }
    if (this.mListener != null)
      this.mListener.onPageSelected(paramInt);
  }

  @SuppressLint({"ClickableViewAccessibility"})
  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    if (super.onTouchEvent(paramMotionEvent))
      return true;
    if ((this.mViewPager == null) || (this.mViewPager.getAdapter().getCount() == 0))
      return false;
    int i = 0xFF & paramMotionEvent.getAction();
    int j = -1;
    switch (i)
    {
    case 4:
    default:
    case 0:
    case 2:
    case 1:
    case 3:
    case 5:
      while (true)
      {
        return true;
        MotionEventCompat.getPointerId(paramMotionEvent, 0);
        paramMotionEvent.getX();
        continue;
        float f3 = MotionEventCompat.getX(paramMotionEvent, MotionEventCompat.findPointerIndex(paramMotionEvent, j)) + 1.0F;
        if ((!this.mIsDragging) && (Math.abs(f3) > this.mTouchSlop))
          this.mIsDragging = true;
        if ((this.mIsDragging) && ((this.mViewPager.isFakeDragging()) || (this.mViewPager.beginFakeDrag())))
        {
          this.mViewPager.fakeDragBy(f3);
          continue;
          if (!this.mIsDragging)
          {
            int i1 = this.mViewPager.getAdapter().getCount();
            int i2 = getWidth();
            float f1 = i2 / 2.0F;
            float f2 = i2 / 6.0F;
            if ((this.mCurrentPage > 0) && (paramMotionEvent.getX() < f1 - f2))
            {
              if (i != 3)
                this.mViewPager.setCurrentItem(-1 + this.mCurrentPage);
              return true;
            }
            if ((this.mCurrentPage < i1 - 1) && (paramMotionEvent.getX() > f1 + f2))
            {
              if (i != 3)
                this.mViewPager.setCurrentItem(1 + this.mCurrentPage);
              return true;
            }
          }
          this.mIsDragging = false;
          if (this.mViewPager.isFakeDragging())
          {
            this.mViewPager.endFakeDrag();
            continue;
            int n = MotionEventCompat.getActionIndex(paramMotionEvent);
            MotionEventCompat.getX(paramMotionEvent, n);
            MotionEventCompat.getPointerId(paramMotionEvent, n);
          }
        }
      }
    case 6:
    }
    int k = MotionEventCompat.getActionIndex(paramMotionEvent);
    if (MotionEventCompat.getPointerId(paramMotionEvent, k) == j)
      if (k != 0)
        break label399;
    label399: for (int m = 1; ; m = 0)
    {
      j = MotionEventCompat.getPointerId(paramMotionEvent, m);
      MotionEventCompat.getX(paramMotionEvent, MotionEventCompat.findPointerIndex(paramMotionEvent, j));
      break;
    }
  }

  public void setCentered(boolean paramBoolean)
  {
    this.mCentered = paramBoolean;
    invalidate();
  }

  public void setCurrentItem(int paramInt)
  {
    if (this.mViewPager == null)
      throw new IllegalStateException("ViewPager has not been bound.");
    this.mViewPager.setCurrentItem(paramInt);
    this.mCurrentPage = paramInt;
    invalidate();
  }

  public void setCurrentItem(int paramInt, boolean paramBoolean)
  {
    if (this.mViewPager == null)
      throw new IllegalStateException("ViewPager has not been bound.");
    this.mViewPager.setCurrentItem(paramInt, paramBoolean);
    this.mCurrentPage = paramInt;
    invalidate();
  }

  public void setFillColor(int paramInt)
  {
    this.mPaintFill.setColor(paramInt);
    invalidate();
  }

  public void setGapBetweenCircles(float paramFloat)
  {
    this.mGapBetweenCircles = paramFloat;
    invalidate();
  }

  public void setLargeRadius(float paramFloat)
  {
    this.mLargeRadius = paramFloat;
    invalidate();
  }

  public void setOnPageChangeListener(ViewPager.OnPageChangeListener paramOnPageChangeListener)
  {
    this.mListener = paramOnPageChangeListener;
  }

  public void setOrientation(int paramInt)
  {
    switch (paramInt)
    {
    default:
      throw new IllegalArgumentException("Orientation must be either HORIZONTAL or VERTICAL.");
    case 0:
    case 1:
    }
    this.mOrientation = paramInt;
    requestLayout();
  }

  public void setPageColor(int paramInt)
  {
    this.mPaintPageFill.setColor(paramInt);
    invalidate();
  }

  public void setSmallRadius(float paramFloat)
  {
    this.mSmallRadius = paramFloat;
    invalidate();
  }

  public void setSnap(boolean paramBoolean)
  {
    this.mSnap = paramBoolean;
    invalidate();
  }

  public void setStrokeColor(int paramInt)
  {
    this.mPaintStroke.setColor(paramInt);
    invalidate();
  }

  public void setStrokeWidth(float paramFloat)
  {
    this.mPaintStroke.setStrokeWidth(paramFloat);
    invalidate();
  }

  public void setViewPager(ViewPager paramViewPager)
  {
    if (this.mViewPager == paramViewPager)
      return;
    if (this.mViewPager != null)
      this.mViewPager.setOnPageChangeListener(null);
    if (paramViewPager.getAdapter() == null)
      throw new IllegalStateException("ViewPager does not have adapter instance.");
    this.mViewPager = paramViewPager;
    this.mViewPager.setOnPageChangeListener(this);
    invalidate();
  }

  public void setViewPager(ViewPager paramViewPager, int paramInt)
  {
    setViewPager(paramViewPager);
    setCurrentItem(paramInt);
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.viewpagerindicator.CirclePageIndicator
 * JD-Core Version:    0.6.2
 */