package com.ikea.kompis.products;

import android.app.Activity;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView.ScaleType;
import com.ikea.kompis.util.UiUtil;
import com.ikea.kompis.view.BasePagerAdapter;
import com.ikea.kompis.view.ZoomableImageView;
import com.squareup.otto.Bus;
import java.util.ArrayList;

public class ZoomableViewPagerAdapter extends BasePagerAdapter
{
  public static final String VIEW_TAG = "VIEW_TAG";
  private final Activity mActivity;
  private final Bus mBus;
  private int mDirection;
  private final ArrayList<String> mImageUriList;
  private final View.OnClickListener mOnClick;
  private int mPrevPosition;
  private boolean mRetainedAfterOrientationChange = false;
  private float[] mSavedScale;

  public ZoomableViewPagerAdapter(Activity paramActivity, ArrayList<String> paramArrayList, View.OnClickListener paramOnClickListener, Bus paramBus)
  {
    this.mActivity = paramActivity;
    this.mImageUriList = paramArrayList;
    this.mOnClick = paramOnClickListener;
    this.mBus = paramBus;
    this.mSavedScale = new float[this.mImageUriList.size()];
    this.mPrevPosition = -1;
  }

  public void destroyItem(View paramView, int paramInt, Object paramObject)
  {
    ((ViewPager)paramView).removeView((View)paramObject);
  }

  public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject)
  {
    super.destroyItem(paramViewGroup, paramInt, paramObject);
    paramViewGroup.removeView((View)paramObject);
  }

  public int getCount()
  {
    return this.mImageUriList.size();
  }

  public String getImageURI(int paramInt)
  {
    return (String)this.mImageUriList.get(paramInt);
  }

  public float[] getSavedScale()
  {
    return this.mSavedScale;
  }

  public Object instantiateItem(ViewGroup paramViewGroup, int paramInt)
  {
    ZoomableImageView localZoomableImageView = new ZoomableImageView(paramViewGroup.getContext());
    localZoomableImageView.setScaleType(ImageView.ScaleType.MATRIX);
    localZoomableImageView.setTag("VIEW_TAG" + paramInt);
    UiUtil.loadImageAsync(this.mActivity, localZoomableImageView, (String)this.mImageUriList.get(paramInt), false);
    localZoomableImageView.init(this.mOnClick, paramInt, this.mBus);
    if (this.mSavedScale[paramInt] > 1.0F)
    {
      if (this.mPrevPosition < 0)
      {
        this.mDirection = 0;
        localZoomableImageView.redrawZoom(this.mSavedScale[paramInt], this.mDirection, this.mRetainedAfterOrientationChange);
      }
    }
    else
    {
      paramViewGroup.addView(localZoomableImageView, -1, -1);
      this.mPrevPosition = paramInt;
      return localZoomableImageView;
    }
    if (this.mPrevPosition < paramInt);
    for (int i = 1; ; i = 2)
    {
      this.mDirection = i;
      break;
    }
  }

  public boolean isViewFromObject(View paramView, Object paramObject)
  {
    return paramView == (View)paramObject;
  }

  public void setRetainedAfterOrientationChange(boolean paramBoolean)
  {
    this.mRetainedAfterOrientationChange = paramBoolean;
  }

  public void setSavedScale(float[] paramArrayOfFloat)
  {
    this.mSavedScale = paramArrayOfFloat;
  }

  public void updateZoomScale(int paramInt, float paramFloat)
  {
    this.mSavedScale[paramInt] = paramFloat;
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.products.ZoomableViewPagerAdapter
 * JD-Core Version:    0.6.2
 */