package com.ikea.kompis;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentManager.BackStackEntry;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.view.ViewPropertyAnimator;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.ikea.kompis.browse.event.GoToSearchEvent;
import com.ikea.kompis.browse.event.ProductDetailsCloseFromSL;
import com.ikea.kompis.extendedcontent.ECStuffActivity;
import com.ikea.kompis.fragments.ContentFragment;
import com.ikea.kompis.products.ProductDetailsActivity;
import com.ikea.kompis.scan.event.ScanEvent;
import com.ikea.kompis.setting.event.LocaleChangeEvent;
import com.ikea.kompis.shopping.ShoppingCartBaseFragment;
import com.ikea.kompis.shopping.ShoppingLayout;
import com.ikea.kompis.shopping.ShoppingLayout.ShoppingCartMotionEventListener;
import com.ikea.kompis.shopping.event.ProductSelectedInSLEvent;
import com.ikea.kompis.shopping.event.SLEvent;
import com.ikea.kompis.shopping.event.ShoppingListStateEvent;
import com.ikea.kompis.user.event.LogoutDoneEvent;
import com.ikea.kompis.util.C.Anim;
import com.ikea.kompis.util.UiUtil;
import com.ikea.kompis.view.SLBadgeTextView;
import com.ikea.shared.AppConfigData;
import com.ikea.shared.AppConfigManager;
import com.ikea.shared.analytics.UsageTracker;
import com.ikea.shared.cart.ShoppingCart;
import com.ikea.shared.config.model.Country;
import com.ikea.shared.products.model.RetailItemCommunication;
import com.ikea.shared.shopping.event.ItemAddedToSLEvent;
import com.ikea.shared.shopping.event.SLChangedEvent;
import com.ikea.shared.util.Constant;
import com.ikea.shared.util.L;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;

public abstract class ShoppingCartActivity extends ECStuffActivity
  implements ShoppingLayout.ShoppingCartMotionEventListener
{
  private static final String BUNDLE_KEY_SHOPPING = "BUNDLE_KEY_SHOPPING";
  private static final String BUNDLE_KEY_SHOPPING_DETAILS_INDEX = "BUNDLE_KEY_SHOPPING_DETAILS_INDEX";
  public static final String BUNDLE_KEY_SL_SELECTED_INDEX = "BUNDLE_KEY_SL_SELECTED_INDEX";
  public static final String CONTENT_FRAGMENT = "CONTENT_FRAGMENT";
  public static final String SHOPPING_LIST_DETAILS_FRAGMENT = "SHOPPING_LIST_DETAILS_FRAGMENT";
  public static final String SHOPPING_LIST_FRAGMENT = "SHOPPING_LIST_FRAGMENT";
  private static final float VIEW_FADED_ANIM_IN = 0.8F;
  private static final float VIEW_FADED_ANIM_OUT = 0.8F;
  private final String TAG = ShoppingCartActivity.class.getSimpleName();
  private ImageView imageView;
  private boolean isHidingSL = false;
  private boolean isLandscape = false;
  private boolean isMaximize = false;
  private boolean isTablet = false;
  private SLBadgeTextView mAcitionBarBadge;
  private SLBadgeTextView mBadge;
  private View mCartBack;
  private View mContentBG;
  private ContentFragment mContentFragment;
  private View mContentLayer;
  private View mContentLayerLayout;
  private View mContentOverlayShadowBG;
  private View mContentView;
  private float mDeviceWidth = 0.0F;
  private EventHandler mEventHandler;
  private final ViewTreeObserver.OnGlobalLayoutListener mLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener()
  {
    private int retrieveStatusBarHeight()
    {
      Rect localRect = new Rect();
      ShoppingCartActivity.this.getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect);
      return localRect.top;
    }

    public void onGlobalLayout()
    {
      ShoppingCartActivity.this.mContentView.getViewTreeObserver().removeGlobalOnLayoutListener(ShoppingCartActivity.this.mLayoutListener);
      if (ShoppingCartActivity.this.isTablet)
      {
        ShoppingCartActivity.this.mShoppingCartContainer.setPadding(0, retrieveStatusBarHeight(), 0, 0);
        ShoppingCartActivity.this.mContentLayerLayout.setPadding(0, retrieveStatusBarHeight(), 0, 0);
      }
      while (ShoppingCartActivity.this.mShopping == null)
        return;
      ShoppingCartActivity.this.mShopping.setParentHeight(ShoppingCartActivity.this.mContentView.getHeight(), retrieveStatusBarHeight(), ShoppingCartActivity.this.isMaximize);
    }
  };
  private final View.OnClickListener mOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      default:
      case 2131624344:
      case 2131624345:
      case 2131624014:
      case 2131623995:
      case 2131624337:
      case 2131624341:
      case 2131624342:
      case 2131624362:
      }
      do
      {
        do
        {
          return;
          ShoppingCartActivity.this.mHandler.postDelayed(new Runnable()
          {
            public void run()
            {
              ShoppingCartActivity.this.mBus.post(new ScanEvent(false));
            }
          }
          , 200L);
          return;
          ShoppingCartActivity.this.hide();
          ShoppingCartActivity.this.mHandler.postDelayed(new Runnable()
          {
            public void run()
            {
              ShoppingCartActivity.this.mBus.post(new GoToSearchEvent(false));
            }
          }
          , 200L);
          return;
          UsageTracker.i().viewSL(ShoppingCartActivity.this, UiUtil.getPageNameFromContentFragment(ShoppingCartActivity.this.mContentFragment));
          ShoppingCartActivity.this.openCart();
        }
        while (!ShoppingCartActivity.this.isLandscape);
        ShoppingCartActivity.this.mBus.post(new ShoppingListStateEvent(true));
        return;
        paramAnonymousView.setVisibility(8);
        return;
      }
      while ((!ShoppingCartActivity.this.isTablet) || (ShoppingCartActivity.this.isHidingSL));
      ShoppingCartActivity.access$1302(ShoppingCartActivity.this, true);
      if (ShoppingCartActivity.this.isLandscape)
        ShoppingCartActivity.this.mBus.post(new ShoppingListStateEvent(false));
      ShoppingCartActivity.this.hide();
    }
  };
  private ViewGroup.LayoutParams mParentLp;
  protected int mProductIndex = 0;
  private ValueAnimator mSLAnimation = null;
  private Animation mSLItemAddedAnimation;
  private TextView mSLTitle;
  private Bitmap mScreenBitmap;
  private final Runnable mSetContentViewLayerToNoneRunnable = new Runnable()
  {
    public void run()
    {
      ShoppingCartActivity.this.mContentOverlayShadowBG.setLayerType(0, null);
      ShoppingCartActivity.this.mContentView.setLayerType(0, null);
    }
  };
  protected ShoppingLayout mShopping;
  private View mShoppingCartContainer;
  private View mShoppingCartIcon;
  private View mShoppingList;
  private boolean mShowOverlayWhileSLOpening = true;
  private ViewGroup parent = null;
  private ShoppingCartBaseFragment shoppingCartContent;
  protected boolean slOpening = false;
  private boolean slShowing = false;

  private void animateOverlayWhileSLOpening(float paramFloat)
  {
    View localView;
    if ((this.mShowOverlayWhileSLOpening) && (this.isLandscape))
    {
      localView = this.mContentLayer;
      if (paramFloat >= 0.8F)
        break label40;
    }
    label40: for (float f = paramFloat + 0.8F; ; f = 1.0F - paramFloat)
    {
      localView.setAlpha(Math.abs(f));
      return;
    }
  }

  private void animateScreenForAddToSL()
  {
    if (!UiUtil.isTablet(this))
    {
      this.mShopping.setListEnable(false);
      this.imageView = new ImageView(this);
      this.imageView.setX(0.0F);
      this.imageView.setY(0.0F);
      View localView = findViewById(16908290);
      if (localView != null)
      {
        this.mScreenBitmap = UiUtil.getViewBitmap(localView);
        if (this.mScreenBitmap != null)
          this.imageView.setImageBitmap(this.mScreenBitmap);
        this.parent = ((ViewGroup)localView.getParent().getParent());
        this.parent.addView(this.imageView, this.parent.getChildCount(), new ViewGroup.LayoutParams(localView.getMeasuredWidth(), localView.getMeasuredHeight()));
      }
      this.imageView.setLayerType(2, null);
      this.imageView.startAnimation(this.mSLItemAddedAnimation);
      this.mShopping.bounceHeight();
      startBringContentBackAnim();
      this.mSLItemAddedAnimation.setAnimationListener(new Animation.AnimationListener()
      {
        public void onAnimationEnd(Animation paramAnonymousAnimation)
        {
          ShoppingCartActivity.this.mHandler.post(new Runnable()
          {
            public void run()
            {
              ShoppingCartActivity.access$1502(ShoppingCartActivity.this, null);
              System.gc();
              ShoppingCartActivity.this.imageView.setLayerType(0, null);
              ShoppingCartActivity.this.imageView.setVisibility(8);
              ShoppingCartActivity.this.mShopping.setListEnable(true);
              Constant.i().setAddToSL(true);
              ShoppingCartActivity.this.parent.removeView(ShoppingCartActivity.this.imageView);
              ShoppingCartActivity.access$1602(ShoppingCartActivity.this, null);
            }
          });
          ShoppingCartActivity.this.cleanupBringContentBackAnim();
        }

        public void onAnimationRepeat(Animation paramAnonymousAnimation)
        {
        }

        public void onAnimationStart(Animation paramAnonymousAnimation)
        {
        }
      });
    }
  }

  private void ensureAnimation()
  {
    if (this.mSLAnimation == null)
    {
      this.mParentLp = this.mContentView.getLayoutParams();
      L.I(this, "ensureAnimation  Display  width : " + this.mDeviceWidth);
      this.mParentLp.width = ((int)this.mDeviceWidth);
      this.mContentView.setLayoutParams(this.mParentLp);
      this.mSLAnimation = ValueAnimator.ofFloat(new float[] { 0.0F, 1.0F });
      this.mSLAnimation.setDuration(500L);
      this.mSLAnimation.setInterpolator(C.Anim.EASE_OUT_QUART_INTERPOLATOR);
      this.mSLAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
      {
        public void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
        {
          ShoppingCartActivity.this.translateSLTo(paramAnonymousValueAnimator.getAnimatedFraction());
        }
      });
      Animator.AnimatorListener local6 = new Animator.AnimatorListener()
      {
        public void onAnimationCancel(Animator paramAnonymousAnimator)
        {
          Log.e(ShoppingCartActivity.this.TAG, "onAnimationCancel ");
        }

        public void onAnimationEnd(Animator paramAnonymousAnimator)
        {
          Log.d(ShoppingCartActivity.this.TAG, "onAnimationEnd ");
          if (ShoppingCartActivity.this.slOpening)
            if (ShoppingCartActivity.this.isLandscape)
            {
              ShoppingCartActivity.this.mContentLayer.setVisibility(8);
              ShoppingCartActivity.this.mContentLayer.setOnClickListener(null);
            }
          while (true)
          {
            ShoppingCartActivity.this.notifyShoppingListTransitionStop(ShoppingCartActivity.this.slOpening);
            ShoppingCartActivity.this.mContentLayer.setLayerType(0, null);
            ShoppingCartActivity.access$1302(ShoppingCartActivity.this, false);
            return;
            ShoppingCartActivity.this.mContentLayer.setVisibility(0);
            ShoppingCartActivity.this.mContentLayer.setOnClickListener(ShoppingCartActivity.this.mOnClickListener);
            continue;
            ShoppingCartActivity.this.mShoppingCartIcon.setVisibility(0);
            ShoppingCartActivity.this.mContentLayer.setOnClickListener(null);
            ShoppingCartActivity.this.mContentLayer.setAlpha(0.0F);
            ShoppingCartActivity.this.mContentLayer.setVisibility(8);
          }
        }

        public void onAnimationRepeat(Animator paramAnonymousAnimator)
        {
          Log.e(ShoppingCartActivity.this.TAG, "onAnimationRepeat ");
        }

        public void onAnimationStart(Animator paramAnonymousAnimator)
        {
          Log.d(ShoppingCartActivity.this.TAG, "onAnimationStart ");
          ShoppingCartActivity.this.mContentLayer.setLayerType(2, null);
          ShoppingCartActivity.this.mContentLayer.setVisibility(0);
          ShoppingCartActivity.this.notifyShoppingListTransitionStart();
        }
      };
      this.mSLAnimation.addListener(local6);
    }
  }

  private void hide()
  {
    this.mBus.post(new ProductDetailsCloseFromSL());
    this.slOpening = false;
    startSLAnimation();
  }

  private void setBadgeCount(int paramInt)
  {
    this.mBadge.setCount(paramInt);
    if (UiUtil.isTablet(this))
    {
      this.mAcitionBarBadge.setCount(paramInt);
      this.mAcitionBarBadge.setSelected(true);
      this.mBadge.setSelected(true);
    }
  }

  private void startBringContentBackAnim()
  {
    this.mContentBG.setVisibility(0);
    this.mContentView.setLayerType(2, null);
    this.mContentOverlayShadowBG.setAlpha(0.7F);
    this.mContentOverlayShadowBG.setVisibility(0);
    this.mContentOverlayShadowBG.setLayerType(2, null);
    this.mContentOverlayShadowBG.animate().alpha(0.0F).setDuration(400L).setStartDelay(100L).start();
    this.mContentView.startAnimation(AnimationUtils.loadAnimation(this, 2130968603));
  }

  private void startSLAnimation()
  {
    ensureAnimation();
    if (this.isLandscape)
      this.mContentLayer.setBackgroundColor(getResources().getColor(17170443));
    while (true)
    {
      this.mSLAnimation.start();
      return;
      this.mContentLayer.setBackgroundColor(getResources().getColor(17170444));
    }
  }

  private void updateBadgeCount(int paramInt)
  {
    this.mBadge.updateCount(paramInt);
    if (UiUtil.isTablet(this))
    {
      this.mAcitionBarBadge.updateCount(paramInt);
      this.mAcitionBarBadge.setSelected(true);
      this.mBadge.setSelected(true);
    }
  }

  private void updateScanView()
  {
    if (!isPaused())
    {
      if ((AppConfigManager.i(this).getAppConfigData() != null) && (AppConfigManager.i(this).getAppConfigData().getConfig() != null) && (AppConfigManager.i(this).getAppConfigData().getConfig().isBarCodeEnabled()))
      {
        findViewById(2131624344).setVisibility(0);
        findViewById(2131624344).setOnClickListener(this.mOnClickListener);
      }
    }
    else
      return;
    findViewById(2131624344).setVisibility(4);
  }

  public void beforeMaximize()
  {
    Log.i(this.TAG, "beforeMaximize ");
    this.isMaximize = true;
    this.mContentBG.setVisibility(0);
    this.mContentView.setLayerType(2, null);
    this.mContentOverlayShadowBG.setLayerType(2, null);
    this.mContentOverlayShadowBG.setAlpha(0.0F);
    this.mContentOverlayShadowBG.setVisibility(0);
    this.mContentOverlayShadowBG.animate().alpha(0.7F).setDuration(200L).start();
    this.mContentView.startAnimation(AnimationUtils.loadAnimation(this, 2130968604));
  }

  public void beforeMinimize()
  {
    Log.i(this.TAG, "beforeMinimize ");
    this.isMaximize = false;
    startBringContentBackAnim();
  }

  public void cleanupBringContentBackAnim()
  {
    this.mContentBG.setVisibility(8);
    this.mHandler.postDelayed(this.mSetContentViewLayerToNoneRunnable, 200L);
    this.mContentOverlayShadowBG.setVisibility(8);
  }

  public void clearBackStackImmeadiate()
  {
    FragmentManager localFragmentManager = getSupportFragmentManager();
    if (localFragmentManager.getBackStackEntryCount() > 0)
      localFragmentManager.popBackStackImmediate(localFragmentManager.getBackStackEntryAt(0).getId(), 1);
  }

  public void closeShoppingList()
  {
    if (this.isTablet)
    {
      hide();
      return;
    }
    this.mShopping.minimize(false);
  }

  public void closeShoppingWithotAnim()
  {
    if (this.isTablet)
    {
      this.slOpening = false;
      this.mShoppingList.setTranslationX(this.mDeviceWidth);
    }
  }

  protected abstract ContentFragment createContentFragment();

  public Fragment getContentFragment()
  {
    return this.mContentFragment;
  }

  public boolean goBack()
  {
    boolean bool1 = true;
    boolean bool2 = this.shoppingCartContent.goBack();
    UsageTracker.i().setBackPressed();
    if ((!bool2) && (!this.mContentFragment.goBack()))
    {
      if (getSupportFragmentManager().getBackStackEntryCount() > 0)
      {
        this.mGoingBack = true;
        bool1 = false;
        getSupportFragmentManager().popBackStack();
      }
    }
    else
      return bool1;
    finish();
    overridePendingTransition(2130968583, 2130968582);
    return bool1;
  }

  public void hideSL()
  {
    if (!this.isTablet)
    {
      showShoppingList(false);
      setListEnabled(false);
    }
    View localView = findViewById(2131624014);
    if ((localView != null) && (this.isTablet))
      localView.setVisibility(8);
    setSlShowing(false);
  }

  public boolean isShoppingListMaximize()
  {
    if (this.isTablet)
      return this.slOpening;
    return this.isMaximize;
  }

  protected boolean isShowOverlayWhileSLOpening()
  {
    return this.mShowOverlayWhileSLOpening;
  }

  public boolean isSlShowing()
  {
    return this.slShowing;
  }

  protected void moveMSLTo(float paramFloat)
  {
    if (!UiUtil.isTablet(this))
      this.mShopping.setTranslationX(paramFloat);
  }

  protected void moveSLTo(float paramFloat)
  {
    float f1 = getResources().getDimensionPixelSize(2131361860);
    if (this.slOpening)
    {
      float f2 = this.mDeviceWidth - f1 * paramFloat;
      L.I(this, "translateTo : translationOpen " + f2);
      this.mShoppingList.setTranslationX(f2);
    }
    if (this.isLandscape)
      this.mContentView.postInvalidate();
  }

  protected void notifyShoppingListTransitionStart()
  {
  }

  protected void notifyShoppingListTransitionStop(boolean paramBoolean)
  {
    if (!paramBoolean)
    {
      if (!UsageTracker.i().isClosingSLForAddProduct())
        break label36;
      UsageTracker.i().setClosingSLForAddProduct(false);
    }
    while (true)
    {
      this.mBus.post(new SLEvent(paramBoolean));
      return;
      label36: UsageTracker.i().setBackPressed();
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    UiUtil.applyLocaleString(this, false);
    setContentView(2130903047);
    this.mEventHandler = new EventHandler(null);
    this.isTablet = UiUtil.isTablet(this);
    this.isLandscape = UiUtil.isLandscape(this);
    this.mDeviceWidth = UiUtil.screenWidth(this);
    Constant.i().setAddToSL(true);
    this.mContentView = ((View)findViewById(16908290).getParent());
    this.mContentView.getViewTreeObserver().addOnGlobalLayoutListener(this.mLayoutListener);
    ViewGroup localViewGroup = (ViewGroup)this.mContentView.getParent();
    localViewGroup.setClipChildren(false);
    LayoutInflater localLayoutInflater = LayoutInflater.from(this);
    this.shoppingCartContent = ShoppingCartBaseFragment.newInstance(this);
    if ((paramBundle != null) && (paramBundle.containsKey("BUNDLE_KEY_SHOPPING_DETAILS_INDEX")))
      this.mProductIndex = paramBundle.getInt("BUNDLE_KEY_SHOPPING_DETAILS_INDEX");
    this.mContentBG = localLayoutInflater.inflate(2130903067, localViewGroup, false);
    this.mContentOverlayShadowBG = localLayoutInflater.inflate(2130903068, localViewGroup, false);
    this.mContentOverlayShadowBG.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
      }
    });
    localViewGroup.addView(this.mContentBG, 0);
    localViewGroup.addView(this.mContentOverlayShadowBG, localViewGroup.getChildCount());
    FrameLayout localFrameLayout;
    if (this.isTablet)
    {
      this.mParentLp = this.mContentView.getLayoutParams();
      this.mShoppingCartContainer = localLayoutInflater.inflate(2130903133, localViewGroup, false);
      this.mContentLayerLayout = localLayoutInflater.inflate(2130903132, localViewGroup, false);
      localViewGroup.addView(this.mShoppingCartContainer, localViewGroup.getChildCount());
      localViewGroup.addView(this.mContentLayerLayout, -1 + localViewGroup.getChildCount());
      this.mShoppingList = findViewById(2131624335);
      this.mShoppingList.setOnClickListener(this.mOnClickListener);
      this.mShoppingList.setTranslationX(this.mDeviceWidth);
      this.mContentLayer = findViewById(2131624341);
      this.mShoppingCartIcon = findViewById(2131624014);
      this.mShoppingCartIcon.setOnClickListener(this.mOnClickListener);
      this.mAcitionBarBadge = ((SLBadgeTextView)findViewById(2131624337).findViewById(2131624364));
      findViewById(2131624337).setOnClickListener(this.mOnClickListener);
      if (paramBundle == null)
      {
        FragmentTransaction localFragmentTransaction = getSupportFragmentManager().beginTransaction();
        localFragmentTransaction.replace(2131624340, this.shoppingCartContent, "SHOPPING_LIST_FRAGMENT");
        localFragmentTransaction.commit();
      }
      this.mCartBack = findViewById(2131624342);
      this.mCartBack.setOnClickListener(this.mOnClickListener);
      this.mSLTitle = ((TextView)findViewById(2131624343));
      this.mSLTitle.setText(getString(2131165702));
      findViewById(2131624345).setOnClickListener(this.mOnClickListener);
      this.mSLItemAddedAnimation = AnimationUtils.loadAnimation(this, 2130968601);
      findViewById(2131623995).setOnClickListener(this.mOnClickListener);
      localFrameLayout = (FrameLayout)findViewById(2131623994);
      if (paramBundle != null)
        break label668;
      this.mContentFragment = createContentFragment();
      getSupportFragmentManager().beginTransaction().add(2131623994, this.mContentFragment, "CONTENT_FRAGMENT").commit();
    }
    while (true)
    {
      localFrameLayout.setOnClickListener(this.mOnClickListener);
      this.mBadge = ((SLBadgeTextView)findViewById(2131624364));
      setBadgeCount(ShoppingCart.i(this).getShoppingItemCount());
      if (paramBundle != null)
      {
        if (!this.isTablet)
          break label687;
        this.slOpening = paramBundle.getBoolean("BUNDLE_KEY_SHOPPING");
        openShoppingList(this.slOpening);
      }
      return;
      this.mShopping = ((ShoppingLayout)localLayoutInflater.inflate(2130903130, localViewGroup, false));
      localViewGroup.addView(this.mShopping, localViewGroup.getChildCount());
      this.mShopping.setContent(getSupportFragmentManager().beginTransaction(), this.shoppingCartContent, "SHOPPING_LIST_FRAGMENT");
      this.mShopping.setEventListener(this);
      break;
      label668: this.mContentFragment = ((ContentFragment)getSupportFragmentManager().findFragmentByTag("CONTENT_FRAGMENT"));
    }
    label687: this.isMaximize = paramBundle.getBoolean("BUNDLE_KEY_SHOPPING");
  }

  public void onMaximized()
  {
    Log.i(this.TAG, "onMaximized ");
    UsageTracker.i().viewSL(this, UiUtil.getPageNameFromContentFragment(this.mContentFragment));
    this.isMaximize = true;
    notifyShoppingListTransitionStop(true);
    this.mContentOverlayShadowBG.setLayerType(0, null);
    this.mContentView.setLayerType(0, null);
  }

  public void onMinimized()
  {
    Log.i(this.TAG, "onMinimized ");
    this.isMaximize = false;
    notifyShoppingListTransitionStop(false);
    cleanupBringContentBackAnim();
  }

  protected void onPause()
  {
    super.onPause();
    try
    {
      this.mBus.unregister(this.mEventHandler);
      this.mBus.unregister(this);
      return;
    }
    catch (Exception localException)
    {
      L.W("No event handler to unregister");
    }
  }

  protected void onResume()
  {
    super.onResume();
    this.mBus.register(this.mEventHandler);
    this.mBus.register(this);
    if (this.isTablet)
      updateScanView();
    setBadgeCount(ShoppingCart.i(this).getShoppingItemCount());
  }

  protected void onSaveInstanceState(Bundle paramBundle)
  {
    super.onSaveInstanceState(paramBundle);
    if (this.isTablet)
      paramBundle.putBoolean("BUNDLE_KEY_SHOPPING", this.slOpening);
    while (true)
    {
      paramBundle.putInt("BUNDLE_KEY_SHOPPING_DETAILS_INDEX", this.mProductIndex);
      L.I(this, "isOpen onSaveInstanceState : " + this.slOpening);
      L.I(this, "isOpen onSaveInstanceState mProductIndex: " + this.mProductIndex);
      return;
      paramBundle.putBoolean("BUNDLE_KEY_SHOPPING", this.isMaximize);
    }
  }

  protected void openCart()
  {
    this.mSLTitle.setText(getString(2131165702));
    this.slOpening = true;
    UiUtil.hideKeyBoard(getApplicationContext(), getCurrentFocus());
    this.mHandler.postDelayed(new Runnable()
    {
      public void run()
      {
        ShoppingCartActivity.this.startSLAnimation();
      }
    }
    , 100L);
  }

  public void openShoppingList(boolean paramBoolean)
  {
    this.isLandscape = UiUtil.isLandscape(this);
    this.mDeviceWidth = UiUtil.screenWidth(this);
    if (paramBoolean)
    {
      this.mShoppingList.setTranslationX(0.0F);
      return;
    }
    this.mShoppingList.setTranslationX(this.mDeviceWidth);
  }

  public void setListEnabled(boolean paramBoolean)
  {
    if (this.mShopping != null)
      this.mShopping.setListEnable(paramBoolean);
  }

  public void setShowOverlayWhileSLOpening(boolean paramBoolean)
  {
    this.mShowOverlayWhileSLOpening = paramBoolean;
  }

  public void setSlShowing(boolean paramBoolean)
  {
    this.slShowing = paramBoolean;
  }

  public void showSL()
  {
    if (!this.isTablet)
    {
      showShoppingList(true);
      setListEnabled(true);
    }
    View localView = findViewById(2131624014);
    if ((localView != null) && (this.isTablet))
      localView.setVisibility(0);
    setSlShowing(true);
  }

  public void showShoppingCartIcon(boolean paramBoolean)
  {
    if (this.mShoppingCartIcon != null)
    {
      if (paramBoolean)
        this.mShoppingCartIcon.setVisibility(0);
    }
    else
      return;
    this.mShoppingCartIcon.setVisibility(8);
  }

  public void showShoppingList(boolean paramBoolean)
  {
    if (this.mShopping != null)
    {
      if (paramBoolean)
      {
        this.mShopping.animate().alpha(1.0F);
        this.mShopping.setVisibility(0);
      }
    }
    else
      return;
    this.mShopping.animate().alpha(0.0F);
    this.mShopping.setVisibility(8);
  }

  protected void translateSLTo(float paramFloat)
  {
    if (this.slOpening)
    {
      float f2 = this.mDeviceWidth - paramFloat * this.mDeviceWidth;
      L.I(this, "translateTo : translationOpen " + f2);
      this.mShoppingList.setTranslationX(f2);
    }
    while (true)
    {
      animateOverlayWhileSLOpening(paramFloat);
      L.I(this, "parent width " + this.mParentLp.width + "   f " + paramFloat);
      return;
      float f1 = paramFloat * this.mDeviceWidth;
      this.mShoppingList.setTranslationX(f1);
    }
  }

  public void updateContentFragment(ContentFragment paramContentFragment, boolean paramBoolean)
  {
    updateContentFragment(paramContentFragment, true, paramBoolean);
  }

  public void updateContentFragment(ContentFragment paramContentFragment, boolean paramBoolean1, boolean paramBoolean2)
  {
    updateContentFragment(paramContentFragment, paramBoolean1, false, paramBoolean2);
  }

  public void updateContentFragment(ContentFragment paramContentFragment, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3)
  {
    while (true)
    {
      FragmentTransaction localFragmentTransaction;
      try
      {
        localFragmentTransaction = getSupportFragmentManager().beginTransaction();
        if (paramBoolean2)
        {
          localFragmentTransaction.setCustomAnimations(0, 0, 0, 0);
          localFragmentTransaction.replace(2131623994, paramContentFragment, paramContentFragment.getClass().getSimpleName());
          if (paramBoolean3)
            localFragmentTransaction.addToBackStack(null);
          localFragmentTransaction.commit();
          this.mContentFragment = paramContentFragment;
          this.mGoingBack = false;
          return;
        }
        if (paramBoolean1)
        {
          localFragmentTransaction.setCustomAnimations(2130968591, 2130968592, 2130968593, 2130968594);
          continue;
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        return;
      }
      localFragmentTransaction.setCustomAnimations(0, 0, 2130968593, 2130968594);
    }
  }

  public void updateContentFragmentBack(ContentFragment paramContentFragment)
  {
    try
    {
      FragmentTransaction localFragmentTransaction = getSupportFragmentManager().beginTransaction();
      localFragmentTransaction.setCustomAnimations(2130968593, 2130968594);
      localFragmentTransaction.replace(2131623994, paramContentFragment, paramContentFragment.getClass().getSimpleName());
      localFragmentTransaction.commit();
      this.mContentFragment = paramContentFragment;
      return;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  public void updateTitleBar(ContentFragment paramContentFragment, boolean paramBoolean1, boolean paramBoolean2, CharSequence paramCharSequence, View paramView, boolean paramBoolean3)
  {
    this.mContentFragment = paramContentFragment;
    super.updateTitleBar(paramBoolean1, paramBoolean2, paramCharSequence, paramView, paramBoolean3);
  }

  private class EventHandler
  {
    private EventHandler()
    {
    }

    @Subscribe
    public void handleLocaleChange(LocaleChangeEvent paramLocaleChangeEvent)
    {
      if (ShoppingCartActivity.this.isTablet)
      {
        ShoppingCartActivity.this.mSLTitle.setText(ShoppingCartActivity.this.getString(2131165702));
        ShoppingCartActivity.this.updateScanView();
        return;
      }
      ShoppingCartActivity.this.mShopping.updateTitle();
    }

    @Subscribe
    public void handleLogout(LogoutDoneEvent paramLogoutDoneEvent)
    {
      ShoppingCartActivity.this.updateBadgeCount(0);
    }

    @Subscribe
    public void handleProductSelected(ProductSelectedInSLEvent paramProductSelectedInSLEvent)
    {
      if (ShoppingCartActivity.this.isTablet)
      {
        RetailItemCommunication localRetailItemCommunication = paramProductSelectedInSLEvent.retailItemCommunication;
        Intent localIntent = new Intent(ShoppingCartActivity.this, ProductDetailsActivity.class);
        localIntent.putExtra("PRODUCT_ID", localRetailItemCommunication.getItemNo());
        localIntent.putExtra("PRODUCT_NAME", localRetailItemCommunication.getProductName());
        localIntent.putExtra("GPR_ORIGIN", localRetailItemCommunication.getGprOrigin());
        ShoppingCartActivity.this.startActivityForResult(localIntent, 3);
        ShoppingCartActivity.this.overridePendingTransition(2130968587, 2130968584);
      }
    }

    @Subscribe
    public void itemAddedToSL(ItemAddedToSLEvent paramItemAddedToSLEvent)
    {
      ShoppingCartActivity.this.animateScreenForAddToSL();
    }

    @Subscribe
    public void upadteBadgeCount(SLChangedEvent paramSLChangedEvent)
    {
      if (paramSLChangedEvent.shoppingCart != null)
      {
        ShoppingCartActivity.this.updateBadgeCount(paramSLChangedEvent.totalProduct);
        return;
      }
      ShoppingCartActivity.this.updateBadgeCount(0);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.ShoppingCartActivity
 * JD-Core Version:    0.6.2
 */