package com.ikea.kompis.browse;

import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.ikea.kompis.products.ProductTopLevelAdapter;
import com.ikea.kompis.util.UiUtil;
import com.ikea.kompis.view.CustomEditText;
import com.ikea.shared.AppError;
import com.ikea.shared.browse.model.CatalogElement;
import com.ikea.shared.util.Constant;
import com.ikea.shared.util.L;
import java.util.List;

public class CategoryTopLevelPhoneFragment extends CategorysBaseFragment
  implements AdapterView.OnItemClickListener
{
  private Parcelable mListState;
  private ListView mListView = null;

  public void onActivityCreated(Bundle paramBundle)
  {
    super.onActivityCreated(paramBundle);
    if ((paramBundle != null) && (paramBundle.containsKey("KEY_LIST_STATE")))
      this.mListState = paramBundle.getParcelable("KEY_LIST_STATE");
  }

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    View localView = paramLayoutInflater.inflate(2130903049, paramViewGroup, false);
    this.mListView = ((ListView)localView.findViewById(2131624001));
    this.mProgressBar = ((ProgressBar)localView.findViewById(2131624004));
    this.mErrorMessage = ((TextView)localView.findViewById(2131624003));
    this.mListView.setOnItemClickListener(this);
    this.mFadeView = localView.findViewById(2131624005);
    this.mFadeView.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        UiUtil.hideKeyBoard(CategoryTopLevelPhoneFragment.this.mParent, CategoryTopLevelPhoneFragment.this.mListView);
        CategoryTopLevelPhoneFragment.this.mListView.requestFocus();
      }
    });
    this.mHandler.postDelayed(new Runnable()
    {
      public void run()
      {
        UiUtil.showKeyBoard(CategoryTopLevelPhoneFragment.this.mParent, CategoryTopLevelPhoneFragment.this.mSearch);
      }
    }
    , 500L);
    return localView;
  }

  public void onItemClick(AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong)
  {
    paramView.setSelected(true);
    CatalogElement localCatalogElement = (CatalogElement)paramAdapterView.getAdapter().getItem(paramInt);
    if (paramInt < this.mSizeOfSeasonal)
    {
      L.I("this is  mSizeOfSeasonal item");
      moveToNext(localCatalogElement, true);
      return;
    }
    moveToNext(localCatalogElement, false);
  }

  public void onResume()
  {
    super.onResume();
    if ((this.mKeyboardOpened) || (Constant.i().isKeyBoardOpen()))
    {
      Constant.i().setKeyBoardOpen(false);
      this.mSearch.requestFocus();
      UiUtil.showKeyBoard(this.mParent, this.mSearch);
      this.mFadeView.setVisibility(0);
      return;
    }
    UiUtil.hideKeyBoard(this.mParent, this.mSearch);
    this.mFadeView.setVisibility(8);
  }

  public void onSaveInstanceState(Bundle paramBundle)
  {
    super.onSaveInstanceState(paramBundle);
    if (this.mListView != null)
    {
      this.mListState = this.mListView.onSaveInstanceState();
      paramBundle.putParcelable("KEY_LIST_STATE", this.mListState);
    }
  }

  public void onStop()
  {
    super.onStop();
    this.mListState = this.mListView.onSaveInstanceState();
    UiUtil.hideKeyBoard(this.mParent, this.mSearch);
    if (this.mFadeView != null)
      this.mFadeView.setVisibility(8);
  }

  public void refreshUI(List<CatalogElement> paramList, AppError paramAppError, Exception paramException)
  {
    if (getActivity() != null)
    {
      this.mPhoneAdapter = new ProductTopLevelAdapter(getActivity(), paramList);
      this.mListView.setAdapter(this.mPhoneAdapter);
      if (this.mListState != null)
      {
        this.mListView.onRestoreInstanceState(this.mListState);
        this.mListState = null;
      }
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.browse.CategoryTopLevelPhoneFragment
 * JD-Core Version:    0.6.2
 */