package com.viewpagerindicator;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

public class ImagePageIndicator extends HorizontalScrollView
  implements PageIndicator, View.OnClickListener
{
  public LinearLayout.LayoutParams layoutParams;
  public final Context mContext;
  public int mCurrentPage;
  public Runnable mIconSelector;
  public final LinearLayout mIconsLayout;
  public ViewPager.OnPageChangeListener mListener;
  public ViewPager mViewPager;

  public ImagePageIndicator(Context paramContext)
  {
    this(paramContext, null);
  }

  public ImagePageIndicator(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    setHorizontalScrollBarEnabled(false);
    this.mContext = paramContext;
    this.mIconsLayout = new LinearLayout(paramContext);
    this.layoutParams = new LinearLayout.LayoutParams(-2, -2);
    this.layoutParams.gravity = 16;
    addView(this.mIconsLayout, this.layoutParams);
  }

  private void animateToIcon(int paramInt)
  {
    final View localView = this.mIconsLayout.getChildAt(paramInt);
    if (this.mIconSelector != null)
      removeCallbacks(this.mIconSelector);
    this.mIconSelector = new Runnable()
    {
      public void run()
      {
        int i = localView.getLeft() - (ImagePageIndicator.this.getWidth() - localView.getWidth()) / 2;
        ImagePageIndicator.this.smoothScrollTo(i, 0);
        ImagePageIndicator.this.mIconSelector = null;
      }
    };
    post(this.mIconSelector);
  }

  public int getCurrentPage()
  {
    return this.mCurrentPage;
  }

  public void notifyDataSetChanged()
  {
  }

  public void onAttachedToWindow()
  {
    super.onAttachedToWindow();
    if (this.mIconSelector != null)
      post(this.mIconSelector);
  }

  public void onClick(View paramView)
  {
    setCurrentItem(paramView.getId());
  }

  public void onDetachedFromWindow()
  {
    super.onDetachedFromWindow();
    if (this.mIconSelector != null)
      removeCallbacks(this.mIconSelector);
  }

  public void onPageScrollStateChanged(int paramInt)
  {
    if (this.mListener != null)
      this.mListener.onPageScrollStateChanged(paramInt);
  }

  public void onPageScrolled(int paramInt1, float paramFloat, int paramInt2)
  {
    if (this.mListener != null)
      this.mListener.onPageScrolled(paramInt1, paramFloat, paramInt2);
  }

  public void onPageSelected(int paramInt)
  {
    setCurrentItem(paramInt);
    if (this.mListener != null)
      this.mListener.onPageSelected(paramInt);
  }

  public void setCurrentItem(int paramInt)
  {
    if (this.mViewPager == null)
      throw new IllegalStateException("ViewPager has not been bound.");
    this.mCurrentPage = paramInt;
    this.mViewPager.setCurrentItem(paramInt);
    int i = this.mIconsLayout.getChildCount();
    int j = 0;
    if (j < i)
    {
      View localView = this.mIconsLayout.getChildAt(j);
      if (j == paramInt);
      for (boolean bool = true; ; bool = false)
      {
        localView.setSelected(bool);
        if (bool)
          animateToIcon(paramInt);
        j++;
        break;
      }
    }
  }

  public void setCurrentItem(int paramInt, boolean paramBoolean)
  {
  }

  public void setOnPageChangeListener(ViewPager.OnPageChangeListener paramOnPageChangeListener)
  {
    this.mListener = paramOnPageChangeListener;
  }

  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;
    paramViewPager.setOnPageChangeListener(this);
    notifyDataSetChanged();
  }

  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.ImagePageIndicator
 * JD-Core Version:    0.6.2
 */