package com.ikea.kompis.products;

import android.app.ActionBar;
import android.content.Context;
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.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.viewpagerindicator.CirclePageIndicator;

public class ProductDetailsPhoneFragment extends ProductDetailsBaseFragment
{
  private int mActionBarHeight;
  private int mCurrentPage;
  private CirclePageIndicator mIndicator;
  private View mRootView = null;
  private final ScrollViewWithScrollEvent.ScrollEventListener mScrollEventListener = new ScrollViewWithScrollEvent.ScrollEventListener()
  {
    public void onScrollChanged(ScrollViewWithScrollEvent paramAnonymousScrollViewWithScrollEvent, int paramAnonymousInt1, int paramAnonymousInt2, int paramAnonymousInt3, int paramAnonymousInt4)
    {
      if (paramAnonymousInt2 < paramAnonymousInt4)
        ProductDetailsPhoneFragment.this.mParent.getActionBar().show();
      while (paramAnonymousScrollViewWithScrollEvent.getScrollY() <= ProductDetailsPhoneFragment.this.mActionBarHeight)
        return;
      ProductDetailsPhoneFragment.this.mParent.getActionBar().hide();
    }
  };

  protected View getRightMenu(Context paramContext, ViewGroup paramViewGroup)
  {
    View localView = new View(this.mParent);
    localView.setLayoutParams(new LinearLayout.LayoutParams(-2, -1));
    return localView;
  }

  public boolean goBack()
  {
    this.mParent.getActionBar().show();
    return super.goBack();
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    if ((!UiUtil.isTablet(getActivity())) && (this.mFromSL));
    for (this.mScreenHeight = UiUtil.screenHeight(getActivity()); ; this.mScreenHeight = (UiUtil.screenHeight(getActivity()) - (int)getResources().getDimension(2131361930)))
      do
      {
        this.mScreenWidth = ((int)UiUtil.screenWidth(getActivity()));
        this.mParent.getActionBar().show();
        return;
      }
      while ((UiUtil.isTablet(getActivity())) || (this.mFromSL));
  }

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    this.mRootView = paramLayoutInflater.inflate(2130903117, paramViewGroup, false);
    this.mActionBarHeight = ((int)getResources().getDimension(2131361870));
    this.mContentLayout = ((ScrollViewWithScrollEvent)this.mRootView.findViewById(2131624259));
    this.mContentLayout.setScrollEventListener(this.mScrollEventListener);
    this.mContentLayout.setOverScrollMode(2);
    this.mProgressBar = ((ProgressBar)this.mRootView.findViewById(2131624004));
    this.mChangeStateProgressBar = ((ProgressBar)this.mRootView.findViewById(2131624083));
    this.mChangeStateProgressBarLayout = this.mRootView.findViewById(2131624082);
    ((ViewGroup)this.mRootView.findViewById(2131624288)).setLayoutAnimation(UiUtil.funkyChunkAnimationController(this.mParent));
    View localView1 = this.mRootView.findViewById(2131624292);
    View localView2 = this.mRootView.findViewById(2131624291);
    localView1.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ProductDetailsPhoneFragment.this.confirmRemoveItem();
      }
    });
    if (this.mFromSL)
    {
      this.mContentLayout.setPadding(0, 0, 0, 0);
      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.mPager = ((ViewPager)this.mRootView.findViewById(2131624261));
    LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, this.mScreenWidth);
    this.mPager.setLayoutParams(localLayoutParams);
    this.mIndicator = ((CirclePageIndicator)this.mRootView.findViewById(2131624262));
    this.mIndicator.setOnClickListener(null);
    showProgressBar(this.mContentLayout);
    refreshView(this.mRootView);
    return this.mRootView;
  }

  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();
    if (this.mParent != null)
      this.mParent.getActionBar().show();
  }

  public void onResume()
  {
    super.onResume();
    showProgressBar(this.mContentLayout);
  }

  public void refreshUI(final RetailItemCommunication paramRetailItemCommunication, AppError paramAppError, Exception paramException)
  {
    this.mRootView.findViewById(2131624260).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);
          ProductDetailsPhoneFragment.this.isOptionChanged = false;
          ProductDetailsPhoneFragment.access$302(ProductDetailsPhoneFragment.this, 0);
        }
      }
      , 100L);
    }
    this.mRetailItemCommunication = paramRetailItemCommunication;
    this.mHandler.post(new Runnable()
    {
      public void run()
      {
        if ((paramRetailItemCommunication != null) && (ProductDetailsPhoneFragment.this.getActivity() != null))
        {
          RetailItemImageList localRetailItemImageList = paramRetailItemCommunication.getRetailItemImageList();
          ProductDetailsPhoneFragment.this.mViewPagerAdapter = new ProductDetailImagePagerAdapter(ProductDetailsPhoneFragment.this.mParent, localRetailItemImageList, ProductDetailsPhoneFragment.this.mBus, ProductDetailsPhoneFragment.this.mFromSL, ProductDetailsPhoneFragment.this.mPager.getWidth());
          ProductDetailsPhoneFragment.this.mPager.setAdapter(ProductDetailsPhoneFragment.this.mViewPagerAdapter);
          if (ProductDetailsPhoneFragment.this.mPager.getAdapter().getCount() <= 1)
            break label176;
          ProductDetailsPhoneFragment.this.mIndicator.setVisibility(0);
          ProductDetailsPhoneFragment.this.mIndicator.setViewPager(ProductDetailsPhoneFragment.this.mPager);
        }
        while (true)
        {
          ProductDetailsPhoneFragment.this.mPager.setCurrentItem(ProductDetailsPhoneFragment.this.mCurrentPage);
          ProductDetailsPhoneFragment.this.refreshValues(paramRetailItemCommunication);
          ProductDetailsPhoneFragment.this.hideProgressBar(ProductDetailsPhoneFragment.this.mContentLayout);
          return;
          label176: ProductDetailsPhoneFragment.this.mIndicator.setVisibility(8);
        }
      }
    });
  }

  protected void updateViewPager(int paramInt)
  {
    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.ProductDetailsPhoneFragment
 * JD-Core Version:    0.6.2
 */