package com.ikea.kompis.view;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.FloatEvaluator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.ikea.kompis.IkeaApplication;
import com.ikea.kompis.products.ProductDetailsActivity;
import com.ikea.kompis.products.event.SPRItemQuantityChangedEvent;
import com.ikea.kompis.shopping.event.ChildItemCollectedEvent;
import com.ikea.kompis.shopping.event.SLItemStateChangeEvent;
import com.ikea.kompis.util.C.Anim;
import com.ikea.kompis.util.DashedLine;
import com.ikea.kompis.util.UiUtil;
import com.ikea.shared.AppConfigData;
import com.ikea.shared.AppConfigManager;
import com.ikea.shared.cart.ShoppingCart;
import com.ikea.shared.products.model.RetailItemCommChild;
import com.ikea.shared.products.model.RetailItemCommunication;
import com.ikea.shared.products.model.RetailItemImage.Size;
import com.ikea.shared.products.model.RetailItemImageList;
import com.ikea.shared.products.service.ProductService;
import com.ikea.shared.products.service.ProductService.STOCK_STATUS;
import com.ikea.shared.stores.model.RetailItemCommChildAvailability;
import com.ikea.shared.stores.model.StoreRef;
import com.ikea.shared.util.L;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;
import java.util.List;
import java.util.UnknownFormatConversionException;

public class SLSPRLayout extends FrameLayout
{
  private boolean isCollected = false;
  private boolean isSwipeRight;
  private boolean isTablet;
  private TextView mAisleLevel;
  private TextView mAisleValue;
  private View mAisleView;
  private View mAlertIcon;
  private float mAnimFrom;
  private float mAnimTo;
  private ValueAnimator mAnimator;
  private View mBottomView;
  private final Bus mBus = IkeaApplication.mBus;
  private boolean mChildCollectFromSL = false;
  private View mChildCollected;
  private TextView mContactStaffInfo;
  private View mContactStaffView;
  private final Context mContext;
  private View mFeedbackView;
  private View mFrontView;
  private long mItemModelUpdatedtime;
  private TextView mLocationLevel;
  private TextView mLocationValue;
  private View mLocationView;
  private TextView mNo;
  private final View.OnClickListener mOnClick = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      default:
        return;
      case 2131624437:
        SLSPRLayout.this.toggleCollected();
        SLSPRLayout.this.hideSprFeedBack(true);
        SLSPRLayout.this.mBus.post(new ChildItemCollectedEvent(SLSPRLayout.this.mParentItem.getItemNo(), SLSPRLayout.this.mRetailItemCommChild.getItemNo(), SLSPRLayout.this.isCollected, SLSPRLayout.this.mChildCollectFromSL));
        return;
      case 2131624438:
      }
      SLSPRLayout.this.hideSprFeedBack(true);
    }
  };
  private final View.OnTouchListener mOnTouchListener = new View.OnTouchListener()
  {
    float mDownX;
    float mDownY;
    float mInitialTx;

    public boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent)
    {
      boolean bool = true;
      L.I("onTouch event :: " + paramAnonymousMotionEvent.getAction());
      switch (paramAnonymousMotionEvent.getAction())
      {
      default:
      case 0:
      case 2:
      case 1:
      }
      do
      {
        bool = false;
        float f1;
        do
        {
          float f2;
          do
          {
            return bool;
            L.I("onTouch ACTION_DOWN");
            this.mDownX = paramAnonymousMotionEvent.getRawX();
            this.mDownY = paramAnonymousMotionEvent.getRawY();
            this.mInitialTx = SLSPRLayout.this.mFrontView.getTranslationX();
            return bool;
            L.I("onTouch ACTION_MOVE");
            SLSPRLayout.access$802(SLSPRLayout.this, false);
            f1 = paramAnonymousMotionEvent.getRawX() - this.mDownX;
            f2 = paramAnonymousMotionEvent.getRawY() - this.mDownY;
          }
          while (((Math.abs(f1) <= 2 * ViewConfiguration.get(SLSPRLayout.this.getContext()).getScaledTouchSlop()) || (Math.abs(f2) >= Math.abs(f1) / 2.0F)) && (!SLSPRLayout.this.mTracking));
          SLSPRLayout.access$902(SLSPRLayout.this, bool);
          SLSPRLayout.this.getParent().requestDisallowInterceptTouchEvent(bool);
          L.D("tX" + SLSPRLayout.this.mFrontView.getTranslationX() + "   dX " + f1);
        }
        while ((SLSPRLayout.this.mFrontView.getTranslationX() > SLSPRLayout.this.mWidth / 2.0F) || (f1 <= 0.0F));
        SLSPRLayout.this.translateTo(f1 + this.mInitialTx);
        return bool;
        L.I("onTouch ACTION_UP");
      }
      while (!SLSPRLayout.this.mTracking);
      SLSPRLayout.access$902(SLSPRLayout.this, false);
      if (SLSPRLayout.this.mFrontView.getTranslationX() > SLSPRLayout.this.mWidth / 4.0F)
      {
        SLSPRLayout.access$802(SLSPRLayout.this, bool);
        L.I(this, " Right ");
      }
      SLSPRLayout.this.moveToDefault();
      return bool;
    }
  };
  private ImageView mPackageCardImage;
  private RetailItemCommunication mParentItem;
  private TextView mProductArticleNr;
  private View mProductIcon;
  private TextView mProductName;
  private TextView mProductQty;
  private TextView mProductType;
  private RetailItemCommChild mRetailItemCommChild;
  private DashedLine mSprChildDividerView;
  private TextView mSprTitle;
  private TextView mStockInfo;
  private View mStockInfoView;
  private View mStockLine;
  private boolean mTracking;
  private float mWidth;
  private TextView mYes;

  public SLSPRLayout(Context paramContext)
  {
    this(paramContext, null);
  }

  public SLSPRLayout(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, 0);
  }

  public SLSPRLayout(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    this.mContext = paramContext;
  }

  private void hideSprFeedBack(boolean paramBoolean)
  {
    if (paramBoolean)
      this.mBus.post(new SLItemStateChangeEvent(this.mRetailItemCommChild.getItemNo(), 0));
    this.mFrontView.setVisibility(0);
    this.mBottomView.setVisibility(0);
    this.mFeedbackView.setVisibility(8);
  }

  private void initSPRData()
  {
    this.isTablet = UiUtil.isTablet(this.mContext);
    this.mProductType = ((TextView)findViewById(2131624426));
    this.mProductName = ((TextView)findViewById(2131624427));
    this.mProductArticleNr = ((TextView)findViewById(2131624428));
    this.mProductQty = ((TextView)findViewById(2131624424));
    this.mPackageCardImage = ((ImageView)findViewById(2131624384));
    this.mAisleView = findViewById(2131624385);
    this.mAisleLevel = ((TextView)findViewById(2131624387));
    this.mAisleValue = ((TextView)findViewById(2131624386));
    this.mLocationView = findViewById(2131624388);
    this.mLocationLevel = ((TextView)findViewById(2131624390));
    this.mLocationValue = ((TextView)findViewById(2131624389));
    this.mFrontView = findViewById(2131624423);
    this.mFrontView.setOnTouchListener(this.mOnTouchListener);
    this.mFeedbackView = findViewById(2131624380);
    this.mSprTitle = ((TextView)findViewById(2131624436));
    this.mYes = ((TextView)findViewById(2131624437));
    this.mNo = ((TextView)findViewById(2131624438));
    this.mYes.setOnClickListener(this.mOnClick);
    this.mNo.setOnClickListener(this.mOnClick);
    this.mBottomView = findViewById(2131624422);
    if ((UiUtil.isTablet(this.mContext)) && ((!UiUtil.isTablet7(this.mContext)) || (UiUtil.isLandscape(this.mContext))))
      this.mStockLine = findViewById(2131624435);
    while (true)
    {
      this.mStockInfo = ((TextView)findViewById(2131624393));
      this.mContactStaffInfo = ((TextView)findViewById(2131624432));
      this.mChildCollected = findViewById(2131624429);
      this.mSprChildDividerView = ((DashedLine)findViewById(2131624433));
      this.mProductIcon = findViewById(2131624241);
      this.mAlertIcon = findViewById(2131624425);
      return;
      this.mStockInfoView = findViewById(2131624430);
      this.mContactStaffView = findViewById(2131624431);
    }
  }

  private void moveToDefault()
  {
    this.mAnimFrom = this.mFrontView.getTranslationX();
    this.mAnimTo = 0.0F;
    this.mAnimator.start();
  }

  private void showSprFeedBack()
  {
    this.mBus.post(new SLItemStateChangeEvent(this.mRetailItemCommChild.getItemNo(), 2));
    this.mFrontView.setVisibility(8);
    this.mBottomView.setVisibility(8);
    this.mFeedbackView.setVisibility(0);
  }

  private void swipeChildItem()
  {
    int i = ShoppingCart.i(getContext()).getChildTotalQuantityInSL(this.mRetailItemCommChild.getItemNo());
    if ((!this.mRetailItemCommChild.isCollected()) && (i > 1))
      try
      {
        if (i > this.mRetailItemCommChild.getTotalQuantity())
        {
          TextView localTextView2 = this.mSprTitle;
          Context localContext2 = this.mContext;
          Object[] arrayOfObject2 = new Object[1];
          arrayOfObject2[0] = Integer.valueOf(i);
          localTextView2.setText(localContext2.getString(2131165533, arrayOfObject2));
        }
        while (true)
        {
          showSprFeedBack();
          return;
          TextView localTextView1 = this.mSprTitle;
          Context localContext1 = this.mContext;
          Object[] arrayOfObject1 = new Object[1];
          arrayOfObject1[0] = Integer.valueOf(this.mRetailItemCommChild.getTotalQuantity());
          localTextView1.setText(localContext1.getString(2131165690, arrayOfObject1));
        }
      }
      catch (UnknownFormatConversionException localUnknownFormatConversionException)
      {
        while (true)
          localUnknownFormatConversionException.printStackTrace();
      }
      catch (Exception localException)
      {
        while (true)
          localException.printStackTrace();
      }
    toggleCollected();
    this.mBus.post(new ChildItemCollectedEvent(this.mParentItem.getItemNo(), this.mRetailItemCommChild.getItemNo(), this.isCollected, this.mChildCollectFromSL));
  }

  private void toggleCollected()
  {
    L.I(" current child Item isCollected() : " + this.mRetailItemCommChild.isCollected());
    if (!this.mRetailItemCommChild.isCollected());
    for (boolean bool = true; ; bool = false)
    {
      this.isCollected = bool;
      this.mRetailItemCommChild.setCollected(this.isCollected);
      ShoppingCart.i(this.mContext).updateChildCollectedStatus(this.mRetailItemCommChild.getItemNo(), this.isCollected);
      return;
    }
  }

  private void translateTo(float paramFloat)
  {
    this.mFrontView.setTranslationX(paramFloat);
  }

  private void updateAisleAndLocation()
  {
    if ((!this.mRetailItemCommChild.getAisle().isEmpty()) && (!this.mRetailItemCommChild.getAisle().equalsIgnoreCase("N/A")) && (!this.mRetailItemCommChild.getLocation().isEmpty()) && (!this.mRetailItemCommChild.getLocation().equalsIgnoreCase("N/A")))
    {
      this.mAisleView.setVisibility(0);
      this.mLocationView.setVisibility(0);
    }
  }

  private void updateAlertOrProductIcon(RetailItemCommChildAvailability paramRetailItemCommChildAvailability, ProductService.STOCK_STATUS paramSTOCK_STATUS, RetailItemCommChild paramRetailItemCommChild)
  {
    if ((this.mContactStaffInfo != null) && (paramSTOCK_STATUS != ProductService.STOCK_STATUS.NOT_SALE))
    {
      if ((!paramRetailItemCommChildAvailability.getSalesMethodCode().equals("3")) && (!paramRetailItemCommChildAvailability.getSalesMethodCode().equals("2")))
        break label75;
      this.mContactStaffInfo.setText(this.mContext.getString(2131165294));
      this.mProductIcon.setVisibility(8);
      this.mAlertIcon.setVisibility(0);
    }
    label75: 
    do
    {
      return;
      if (paramRetailItemCommChildAvailability.getSalesMethodCode().equals("0"))
      {
        TextView localTextView = this.mContactStaffInfo;
        Context localContext = this.mContext;
        Object[] arrayOfObject = new Object[1];
        arrayOfObject[0] = paramRetailItemCommChild.getDepartmentName();
        localTextView.setText(localContext.getString(2131165357, arrayOfObject));
        this.mProductIcon.setVisibility(8);
        this.mAlertIcon.setVisibility(0);
        return;
      }
    }
    while (!TextUtils.isEmpty(paramRetailItemCommChildAvailability.getSalesMethodCode()));
    this.mContactStaffInfo.setText(this.mContext.getString(2131165294));
    if ((this.isTablet) && ((!UiUtil.isTablet7(this.mContext)) || (UiUtil.isLandscape(this.mContext))))
      this.mContactStaffInfo.setVisibility(0);
    while (true)
    {
      this.mProductIcon.setVisibility(8);
      this.mAlertIcon.setVisibility(0);
      return;
      this.mContactStaffView.setVisibility(0);
    }
  }

  private void updateCollectedState(boolean paramBoolean)
  {
    float f1 = 0.6F;
    int i = 8;
    this.mBottomView.setSelected(paramBoolean);
    TextView localTextView1 = this.mProductArticleNr;
    int j;
    int k;
    label48: int m;
    label68: int i1;
    label122: int i2;
    label149: label166: label172: float f2;
    label198: float f3;
    label218: float f4;
    label238: View localView3;
    if (paramBoolean)
    {
      j = i;
      localTextView1.setVisibility(j);
      TextView localTextView2 = this.mProductQty;
      if (!paramBoolean)
        break label268;
      k = 4;
      localTextView2.setVisibility(k);
      View localView1 = this.mChildCollected;
      if (!paramBoolean)
        break label274;
      m = 0;
      localView1.setVisibility(m);
      if (paramBoolean)
      {
        if ((!UiUtil.isTablet(this.mContext)) || ((UiUtil.isTablet7(this.mContext)) && (!UiUtil.isLandscape(this.mContext))))
          break label297;
        TextView localTextView5 = this.mStockInfo;
        if (!paramBoolean)
          break label280;
        i1 = i;
        localTextView5.setVisibility(i1);
        if (this.mStockLine != null)
        {
          View localView6 = this.mStockLine;
          if (!paramBoolean)
            break label286;
          i2 = i;
          localView6.setVisibility(i2);
        }
        TextView localTextView6 = this.mContactStaffInfo;
        if (!paramBoolean)
          break label292;
        localTextView6.setVisibility(i);
      }
      updateStockAndLocation(this.mRetailItemCommChild, paramBoolean);
      updateAisleAndLocation();
      View localView2 = this.mProductIcon;
      if (!paramBoolean)
        break label361;
      f2 = f1;
      localView2.setAlpha(f2);
      TextView localTextView3 = this.mProductName;
      if (!paramBoolean)
        break label367;
      f3 = f1;
      localTextView3.setAlpha(f3);
      TextView localTextView4 = this.mProductType;
      if (!paramBoolean)
        break label373;
      f4 = f1;
      localTextView4.setAlpha(f4);
      localView3 = this.mAlertIcon;
      if (!paramBoolean)
        break label379;
    }
    while (true)
    {
      localView3.setAlpha(f1);
      return;
      j = 0;
      break;
      label268: k = 0;
      break label48;
      label274: m = i;
      break label68;
      label280: i1 = 0;
      break label122;
      label286: i2 = 0;
      break label149;
      label292: i = 0;
      break label166;
      label297: int n;
      label317: View localView4;
      if (this.mStockInfoView != null)
      {
        View localView5 = this.mStockInfoView;
        if (paramBoolean)
        {
          n = i;
          localView5.setVisibility(n);
        }
      }
      else
      {
        if (this.mContactStaffView == null)
          break label172;
        localView4 = this.mContactStaffView;
        if (!paramBoolean)
          break label356;
      }
      while (true)
      {
        localView4.setVisibility(i);
        break;
        n = 0;
        break label317;
        label356: i = 0;
      }
      label361: f2 = 1.0F;
      break label198;
      label367: f3 = 1.0F;
      break label218;
      label373: f4 = 1.0F;
      break label238;
      label379: f1 = 1.0F;
    }
  }

  private void updateFeedBackMessage()
  {
    int i = ShoppingCart.i(getContext()).getChildTotalQuantityInSL(this.mRetailItemCommChild.getItemNo());
    try
    {
      if (i > this.mRetailItemCommChild.getTotalQuantity())
      {
        TextView localTextView2 = this.mSprTitle;
        Context localContext2 = this.mContext;
        Object[] arrayOfObject2 = new Object[1];
        arrayOfObject2[0] = Integer.valueOf(i);
        localTextView2.setText(localContext2.getString(2131165533, arrayOfObject2));
        return;
      }
      TextView localTextView1 = this.mSprTitle;
      Context localContext1 = this.mContext;
      Object[] arrayOfObject1 = new Object[1];
      arrayOfObject1[0] = Integer.valueOf(this.mRetailItemCommChild.getTotalQuantity());
      localTextView1.setText(localContext1.getString(2131165690, arrayOfObject1));
      return;
    }
    catch (UnknownFormatConversionException localUnknownFormatConversionException)
    {
      localUnknownFormatConversionException.printStackTrace();
      return;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  private void updateStockAndLocation(RetailItemCommChild paramRetailItemCommChild, boolean paramBoolean)
  {
    RetailItemCommChildAvailability localRetailItemCommChildAvailability = paramRetailItemCommChild.getStockAvailability();
    if (localRetailItemCommChildAvailability != null);
    while (true)
    {
      try
      {
        localSTOCK_STATUS = ProductService.i(this.mContext).getStockStatus(localRetailItemCommChildAvailability);
        if (paramBoolean)
        {
          updateAlertOrProductIcon(localRetailItemCommChildAvailability, localSTOCK_STATUS, this.mRetailItemCommChild);
          if ((paramRetailItemCommChild.getAisle().isEmpty()) || (paramRetailItemCommChild.getAisle().equals("N/A")) || (paramRetailItemCommChild.getLocation().isEmpty()) || (paramRetailItemCommChild.getLocation().equals("N/A")))
          {
            this.mProductIcon.setVisibility(8);
            this.mAlertIcon.setVisibility(0);
          }
          return;
        }
        if ((this.isTablet) && (this.mStockInfo != null))
        {
          this.mStockInfo.setVisibility(0);
          if (this.mStockLine != null)
            this.mStockLine.setVisibility(0);
          if (localSTOCK_STATUS != ProductService.STOCK_STATUS.LOW_STOCK)
            continue;
          this.mStockInfo.setText(this.mContext.getString(2131165449));
          this.mStockInfo.setEnabled(false);
          if ((!this.isTablet) || ((UiUtil.isTablet7(this.mContext)) && (!UiUtil.isLandscape(this.mContext))))
            continue;
          this.mContactStaffInfo.setVisibility(8);
          this.mProductIcon.setVisibility(0);
          this.mAlertIcon.setVisibility(8);
          if ((this.mContactStaffInfo == null) || (localSTOCK_STATUS == ProductService.STOCK_STATUS.NOT_SALE))
            continue;
          if ((!localRetailItemCommChildAvailability.getSalesMethodCode().equals("3")) && (!localRetailItemCommChildAvailability.getSalesMethodCode().equals("2")))
            continue;
          this.mContactStaffInfo.setText(this.mContext.getString(2131165294));
          if ((!this.isTablet) || ((UiUtil.isTablet7(this.mContext)) && (!UiUtil.isLandscape(this.mContext))))
            continue;
          this.mContactStaffInfo.setVisibility(0);
          this.mProductIcon.setVisibility(8);
          this.mAlertIcon.setVisibility(0);
          continue;
        }
      }
      catch (Exception localException)
      {
        ProductService.STOCK_STATUS localSTOCK_STATUS;
        localException.printStackTrace();
        continue;
        if ((this.isTablet) || (this.mStockInfoView == null))
          continue;
        this.mStockInfoView.setVisibility(0);
        continue;
        if (localSTOCK_STATUS == ProductService.STOCK_STATUS.NOT_STOCK)
        {
          this.mStockInfo.setText(this.mContext.getString(2131165501));
          this.mStockInfo.setSelected(true);
          continue;
        }
        if ((localSTOCK_STATUS == ProductService.STOCK_STATUS.NOT_INFO) || (localSTOCK_STATUS == ProductService.STOCK_STATUS.NONE))
        {
          this.mStockInfo.setText(this.mContext.getString(2131165673));
          this.mStockInfo.setActivated(true);
          this.mStockInfo.setSelected(false);
          continue;
        }
        if (localSTOCK_STATUS == ProductService.STOCK_STATUS.NOT_SALE)
        {
          this.mStockInfo.setText(this.mContext.getString(2131165500) + " " + UiUtil.getFormatedStoreName(this.mContext, AppConfigManager.i(this.mContext).getAppConfigData().getFavStore().getStoreName()));
          this.mStockInfo.setActivated(true);
          continue;
        }
        if (localSTOCK_STATUS == ProductService.STOCK_STATUS.NO_SERVICE)
        {
          this.mStockInfo.setText(this.mContext.getString(2131165495));
          this.mStockInfo.setSelected(true);
          continue;
        }
        if (localSTOCK_STATUS == ProductService.STOCK_STATUS.ORDER_IN_STORE)
        {
          this.mStockInfo.setText(this.mContext.getString(2131165271) + " " + UiUtil.getFormatedStoreName(this.mContext, AppConfigManager.i(this.mContext).getAppConfigData().getFavStore().getStoreName()));
          this.mStockInfo.setSelected(false);
          this.mStockInfo.setEnabled(true);
          continue;
        }
        if ((this.isTablet) && (this.mStockLine != null))
        {
          this.mStockInfo.setVisibility(8);
          if (this.mStockLine == null)
            continue;
          this.mStockLine.setVisibility(8);
          continue;
        }
        if ((this.isTablet) || (this.mStockInfoView == null))
          continue;
        this.mStockInfoView.setVisibility(8);
        continue;
        this.mContactStaffView.setVisibility(8);
        continue;
        this.mContactStaffView.setVisibility(0);
        continue;
        if (localRetailItemCommChildAvailability.getSalesMethodCode().equals("0"))
        {
          TextView localTextView = this.mContactStaffInfo;
          Context localContext = this.mContext;
          Object[] arrayOfObject = new Object[1];
          arrayOfObject[0] = paramRetailItemCommChild.getDepartmentName();
          localTextView.setText(localContext.getString(2131165357, arrayOfObject));
          if ((this.isTablet) && ((!UiUtil.isTablet7(this.mContext)) || (UiUtil.isLandscape(this.mContext))))
          {
            this.mContactStaffInfo.setVisibility(0);
            this.mProductIcon.setVisibility(8);
            this.mAlertIcon.setVisibility(0);
            continue;
          }
          this.mContactStaffView.setVisibility(0);
          continue;
        }
        if (!TextUtils.isEmpty(localRetailItemCommChildAvailability.getSalesMethodCode()))
          continue;
        this.mContactStaffInfo.setText(this.mContext.getString(2131165294));
        if (!this.isTablet)
          break label959;
      }
      if ((!UiUtil.isTablet7(this.mContext)) || (UiUtil.isLandscape(this.mContext)))
        this.mContactStaffInfo.setVisibility(0);
      while (true)
      {
        this.mProductIcon.setVisibility(8);
        this.mAlertIcon.setVisibility(0);
        break;
        label959: this.mContactStaffView.setVisibility(0);
      }
      this.mAisleValue.setText("N/A");
      this.mLocationValue.setText("N/A");
    }
  }

  public RetailItemCommChild getChildItem()
  {
    return this.mRetailItemCommChild;
  }

  public RetailItemCommunication getItem()
  {
    return this.mParentItem;
  }

  public long getItemLastUpdatedTime()
  {
    return this.mItemModelUpdatedtime;
  }

  public String getItemNo()
  {
    return this.mRetailItemCommChild.getItemNo();
  }

  @Subscribe
  public void handleCollectedState(ChildItemCollectedEvent paramChildItemCollectedEvent)
  {
    if (this.mRetailItemCommChild.getItemNo().equalsIgnoreCase(paramChildItemCollectedEvent.itemNo))
    {
      if (!paramChildItemCollectedEvent.fromSL)
        break label33;
      updateCollectedState(paramChildItemCollectedEvent.isCollected);
    }
    label33: 
    while (!((Activity)this.mContext).getClass().getSimpleName().equals(ProductDetailsActivity.class.getSimpleName()))
      return;
    updateCollectedState(paramChildItemCollectedEvent.isCollected);
  }

  @Subscribe
  public void handleQuantityChange(SPRItemQuantityChangedEvent paramSPRItemQuantityChangedEvent)
  {
    if (paramSPRItemQuantityChangedEvent.itemNumber.equalsIgnoreCase(this.mParentItem.getItemNo()))
    {
      this.mProductQty.setText(paramSPRItemQuantityChangedEvent.updatedQuantity * this.mRetailItemCommChild.getQuantity() + getResources().getString(2131165741));
      this.isCollected = false;
      this.mRetailItemCommChild.setCollected(this.isCollected);
      handleCollectedState(new ChildItemCollectedEvent(paramSPRItemQuantityChangedEvent.itemNumber, this.mRetailItemCommChild.getItemNo(), false, false));
      this.mBus.post(new ChildItemCollectedEvent(this.mParentItem.getItemNo(), this.mRetailItemCommChild.getItemNo(), this.isCollected, this.mChildCollectFromSL));
    }
  }

  protected void onAttachedToWindow()
  {
    super.onAttachedToWindow();
    this.mBus.register(this);
  }

  protected void onDetachedFromWindow()
  {
    super.onDetachedFromWindow();
    try
    {
      this.mBus.unregister(this);
      return;
    }
    catch (Exception localException)
    {
      L.W("No event handler to unregister");
    }
  }

  protected void onFinishInflate()
  {
    super.onFinishInflate();
    initSPRData();
    final FloatEvaluator localFloatEvaluator = new FloatEvaluator();
    this.mAnimator = ValueAnimator.ofFloat(new float[] { 0.0F, 1.0F });
    this.mAnimator.setDuration(500L);
    this.mAnimator.setInterpolator(C.Anim.EASE_OUT_QUART_INTERPOLATOR);
    this.mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
    {
      public void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
      {
        float f = localFloatEvaluator.evaluate(paramAnonymousValueAnimator.getAnimatedFraction(), Float.valueOf(SLSPRLayout.this.mAnimFrom), Float.valueOf(SLSPRLayout.this.mAnimTo)).floatValue();
        SLSPRLayout.this.translateTo(f);
      }
    });
    this.mAnimator.addListener(new Animator.AnimatorListener()
    {
      public void onAnimationCancel(Animator paramAnonymousAnimator)
      {
      }

      public void onAnimationEnd(Animator paramAnonymousAnimator)
      {
        if (SLSPRLayout.this.isSwipeRight)
          SLSPRLayout.this.swipeChildItem();
        SLSPRLayout.access$802(SLSPRLayout.this, false);
      }

      public void onAnimationRepeat(Animator paramAnonymousAnimator)
      {
      }

      public void onAnimationStart(Animator paramAnonymousAnimator)
      {
      }
    });
  }

  protected void onSizeChanged(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    super.onSizeChanged(paramInt1, paramInt2, paramInt3, paramInt4);
    if (UiUtil.isTablet(this.mContext))
    {
      this.mWidth = (2.0F * getResources().getDimension(2131361805));
      return;
    }
    this.mWidth = paramInt1;
  }

  public void updateData(Context paramContext, RetailItemCommunication paramRetailItemCommunication, RetailItemCommChild paramRetailItemCommChild, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, int paramInt)
  {
    this.mParentItem = paramRetailItemCommunication;
    this.mRetailItemCommChild = paramRetailItemCommChild;
    this.mItemModelUpdatedtime = this.mParentItem.getLastUpDatedTime();
    this.mChildCollectFromSL = paramBoolean2;
    hideSprFeedBack(false);
    if (!paramBoolean3)
      this.mFrontView.setOnTouchListener(null);
    int i;
    int j;
    if (paramBoolean2)
    {
      i = getResources().getColor(2131492927);
      setBackgroundColor(i);
      View localView = this.mFrontView;
      if (!paramBoolean2)
        break label521;
      j = getResources().getColor(2131492927);
      label91: localView.setBackgroundColor(j);
      if (!paramBoolean2)
        break label536;
      this.mSprChildDividerView.needDashedLine(true);
      label111: if ((!TextUtils.isEmpty(paramRetailItemCommChild.getProductTypeName())) && (paramRetailItemCommChild.getProductTypeName().length() > 1))
        this.mProductType.setText(Character.toUpperCase(paramRetailItemCommChild.getProductTypeName().charAt(0)) + paramRetailItemCommChild.getProductTypeName().substring(1));
      this.mProductName.setText(paramRetailItemCommChild.getProductName());
      if (!paramBoolean3)
        break label547;
      this.mProductQty.setText(paramRetailItemCommChild.getTotalQuantity() + getResources().getString(2131165741));
      label227: this.mProductArticleNr.setText(UiUtil.getFormatedArtical(paramRetailItemCommChild.getItemNo()));
      String str = "";
      if ((paramRetailItemCommChild.getRetailItemImageList() != null) && (paramRetailItemCommChild.getRetailItemImageList().getRetailItemImage() != null) && (paramRetailItemCommChild.getRetailItemImageList().getRetailItemImage().size() > 0))
        str = UiUtil.getImageURL(RetailItemImage.Size.S3, paramRetailItemCommChild.getRetailItemImageList().getRetailItemImage());
      if (str.isEmpty())
        break label587;
      this.mPackageCardImage.setVisibility(0);
      UiUtil.loadImageAsyncWithPause(this.mContext, this.mPackageCardImage, str);
      label322: this.mAisleView.setVisibility(8);
      this.mLocationView.setVisibility(8);
      this.mAisleValue.setText(paramRetailItemCommChild.getAisle());
      this.mLocationValue.setText(paramRetailItemCommChild.getLocation());
      if ((!this.isTablet) || (this.mStockInfo == null))
        break label599;
      this.mStockInfo.setVisibility(8);
    }
    while (true)
    {
      if (this.mStockLine != null)
        this.mStockLine.setVisibility(8);
      if (this.mYes != null)
        this.mYes.setText(2131165743);
      if (this.mNo != null)
        this.mNo.setText(2131165489);
      if (this.mAisleLevel != null)
        this.mAisleLevel.setText(2131165259);
      if (this.mLocationLevel != null)
        this.mLocationLevel.setText(2131165439);
      updateCollectedState(paramRetailItemCommChild.isCollected());
      if (paramBoolean1)
        this.mSprChildDividerView.setVisibility(8);
      if (paramInt == 2)
      {
        updateFeedBackMessage();
        showSprFeedBack();
      }
      return;
      i = getResources().getColor(2131492940);
      break;
      label521: j = getResources().getColor(2131492940);
      break label91;
      label536: this.mSprChildDividerView.needDashedLine(false);
      break label111;
      label547: this.mProductQty.setText(paramRetailItemCommChild.getQuantity() + getResources().getString(2131165741));
      break label227;
      label587: this.mPackageCardImage.setVisibility(8);
      break label322;
      label599: if ((!this.isTablet) && (this.mStockInfoView != null))
        this.mStockInfoView.setVisibility(8);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.view.SLSPRLayout
 * JD-Core Version:    0.6.2
 */