package com.ikea.kompis.products;

import android.app.ActionBar;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
import com.ikea.kompis.ShoppingCartActivity;
import com.ikea.kompis.util.UiUtil;
import com.ikea.kompis.view.CustomImagePageIndicator;
import com.ikea.kompis.view.ScrollViewWithScrollEvent;
import com.ikea.kompis.view.ScrollViewWithScrollEvent.ScrollEventListener;
import com.ikea.shared.AppError;
import com.ikea.shared.products.model.RetailItemCommunication;
import com.ikea.shared.products.model.RetailItemImageList;
import com.ikea.shared.util.L;
import com.viewpagerindicator.CirclePageIndicator;
import com.viewpagerindicator.PageIndicator;

public class ProductDetailsTabFragment extends ProductDetailsBaseFragment
{
  private static final String KEY_VIEW_PAGER_CURRENT_PAGE = "KEY_VIEW_PAGER_CURRENT_PAGE";
  private static final String TAG = ProductDetailsTabFragment.class.getSimpleName();
  private int mActionBarHeight;
  private int mCurrentPage;
  private PageIndicator mIndicator;
  private View mRootView;
  private final ScrollViewWithScrollEvent.ScrollEventListener mScrollEventListener = new ScrollViewWithScrollEvent.ScrollEventListener()
  {
    public void onScrollChanged(ScrollViewWithScrollEvent paramAnonymousScrollViewWithScrollEvent, int paramAnonymousInt1, int paramAnonymousInt2, int paramAnonymousInt3, int paramAnonymousInt4)
    {
      L.I("l " + paramAnonymousInt1 + " t " + paramAnonymousInt2 + " old l " + paramAnonymousInt3 + " old t " + paramAnonymousInt4);
      if (paramAnonymousInt2 < paramAnonymousInt4)
        ProductDetailsTabFragment.this.mParent.getActionBar().show();
      while (paramAnonymousScrollViewWithScrollEvent.getScrollY() <= ProductDetailsTabFragment.this.mActionBarHeight)
        return;
      ProductDetailsTabFragment.this.mParent.getActionBar().hide();
    }
  };

  public void onActivityCreated(Bundle paramBundle)
  {
    super.onActivityCreated(paramBundle);
    if ((paramBundle != null) && (paramBundle.containsKey("KEY_VIEW_PAGER_CURRENT_PAGE")))
      this.mCurrentPage = paramBundle.getInt("KEY_VIEW_PAGER_CURRENT_PAGE");
  }

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    this.mRootView = paramLayoutInflater.inflate(2130903117, paramViewGroup, false);
    this.mScreenHeight = UiUtil.screenHeight(getActivity());
    this.mScreenWidth = ((int)UiUtil.screenWidth(getActivity()));
    this.mActionBarHeight = ((int)getResources().getDimension(2131361870));
    this.mContentLayout = ((ScrollViewWithScrollEvent)this.mRootView.findViewById(2131624259));
    this.mContentLayout.setScrollEventListener(this.mScrollEventListener);
    this.mContentLayout.setOverScrollMode(2);
    View localView1 = this.mRootView.findViewById(2131624292);
    View localView2 = this.mRootView.findViewById(2131624291);
    View.OnClickListener local2 = new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ProductDetailsTabFragment.this.confirmRemoveItem();
      }
    };
    localView1.setOnClickListener(local2);
    if (this.mFromSL)
    {
      this.mRootView.findViewById(2131624290).setVisibility(0);
      ((TextView)localView1.findViewById(2131624302)).setText(getString(2131165586));
      ((ImageView)localView1.findViewById(2131624301)).setImageDrawable(getActivity().getResources().getDrawable(2130837642));
      ((TextView)localView2.findViewById(2131624302)).setText(getString(2131165364));
      ((ImageView)localView2.findViewById(2131624301)).setImageDrawable(getActivity().getResources().getDrawable(2130837755));
    }
    this.mProgressBar = ((ProgressBar)this.mRootView.findViewById(2131624004));
    this.mChangeStateProgressBar = ((ProgressBar)this.mRootView.findViewById(2131624083));
    this.mChangeStateProgressBarLayout = this.mRootView.findViewById(2131624082);
    this.mPager = ((ViewPager)this.mRootView.findViewById(2131624261));
    View localView3 = this.mRootView.findViewById(2131624295);
    if ((UiUtil.isTablet(this.mParent)) && ((!UiUtil.isTablet7(this.mParent)) || (UiUtil.isLandscape(this.mParent))))
    {
      View localView4 = this.mRootView.findViewById(2131624296);
      int i = (int)getResources().getDimension(2131361847);
      int j = this.mScreenWidth - i;
      localView4.setLayoutParams(new LinearLayout.LayoutParams(i, -2));
      LinearLayout.LayoutParams localLayoutParams2 = (LinearLayout.LayoutParams)localView3.getLayoutParams();
      localLayoutParams2.height = j;
      localLayoutParams2.width = j;
      localView3.setLayoutParams(localLayoutParams2);
      this.mIndicator = ((CustomImagePageIndicator)this.mRootView.findViewById(2131623963));
    }
    while (true)
    {
      showProgressBar(this.mContentLayout);
      refreshView(this.mRootView);
      return this.mRootView;
      LinearLayout.LayoutParams localLayoutParams1 = new LinearLayout.LayoutParams(-1, this.mScreenWidth);
      this.mPager.setLayoutParams(localLayoutParams1);
      this.mIndicator = ((CirclePageIndicator)this.mRootView.findViewById(2131624262));
      ((CirclePageIndicator)this.mIndicator).setOnClickListener(null);
    }
  }

  public void onDestroy()
  {
    super.onDestroy();
    this.mIndicator = null;
    this.mPager = null;
    this.mPagerLayout = null;
    this.mViewPagerAdapter = null;
  }

  public void onPause()
  {
    super.onPause();
    this.mCurrentPage = this.mIndicator.getCurrentPage();
    this.mParent.getActionBar().show();
  }

  public void onResume()
  {
    super.onResume();
    showProgressBar(this.mContentLayout);
  }

  public void onSaveInstanceState(Bundle paramBundle)
  {
    super.onSaveInstanceState(paramBundle);
    paramBundle.putInt("KEY_VIEW_PAGER_CURRENT_PAGE", this.mCurrentPage);
  }

  public void refreshUI(final RetailItemCommunication paramRetailItemCommunication, AppError paramAppError, Exception paramException)
  {
    this.mRootView.findViewById(2131624259).setVisibility(0);
    this.mRootView.findViewById(2131624004).setVisibility(8);
    if (this.isOptionChanged)
    {
      final ScrollView localScrollView = (ScrollView)this.mRootView.findViewById(2131624259);
      this.mHandler.postDelayed(new Runnable()
      {
        public void run()
        {
          localScrollView.smoothScrollTo(0, 0);
          ProductDetailsTabFragment.this.isOptionChanged = false;
          ProductDetailsTabFragment.access$302(ProductDetailsTabFragment.this, 0);
        }
      }
      , 100L);
    }
    this.mRetailItemCommunication = paramRetailItemCommunication;
    this.mHandler.post(new Runnable()
    {
      public void run()
      {
        if ((paramRetailItemCommunication != null) && (ProductDetailsTabFragment.this.mPager != null) && (ProductDetailsTabFragment.this.mIndicator != null))
        {
          RetailItemImageList localRetailItemImageList = paramRetailItemCommunication.getRetailItemImageList();
          ProductDetailsTabFragment.this.mViewPagerAdapter = new ProductDetailImagePagerAdapter(ProductDetailsTabFragment.this.mRootView.getContext(), localRetailItemImageList, ProductDetailsTabFragment.this.mBus, ProductDetailsTabFragment.this.mFromSL, 0);
          ProductDetailsTabFragment.this.mPager.setAdapter(ProductDetailsTabFragment.this.mViewPagerAdapter);
          if (ProductDetailsTabFragment.this.mPager.getAdapter().getCount() > 1)
          {
            ProductDetailsTabFragment.this.mIndicator.setViewPager(ProductDetailsTabFragment.this.mPager);
            ProductDetailsTabFragment.this.mIndicator.notifyDataSetChanged();
            ProductDetailsTabFragment.this.mIndicator.setCurrentItem(ProductDetailsTabFragment.this.mCurrentPage);
          }
          ProductDetailsTabFragment.this.refreshValues(paramRetailItemCommunication);
          ProductDetailsTabFragment.this.hideProgressBar(ProductDetailsTabFragment.this.mContentLayout);
        }
      }
    });
  }

  protected void refreshValues(RetailItemCommunication paramRetailItemCommunication)
  {
    if ((getActivity() != null) && (isAdded()))
      super.refreshValues(paramRetailItemCommunication);
  }

  protected void updateViewPager(int paramInt)
  {
    L.I("updateViewPager");
    this.mCurrentPage = paramInt;
    if (this.mPager != null)
      this.mPager.setCurrentItem(paramInt, false);
  }
}

/* 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.ProductDetailsTabFragment
 * JD-Core Version:    0.6.2
 */