package com.ikea.kompis.fragments;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.ikea.kompis.ShoppingCartActivity;
import com.ikea.kompis.campaign.WelcomeFragment;
import com.ikea.kompis.shopping.event.SLEvent;
import com.ikea.kompis.util.UiUtil;
import com.ikea.shared.util.L;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;

public abstract class ContentFragment extends BaseFragment
{
  private EventHandler mEventHandler;
  protected boolean mUpdateTitle = true;

  protected View getRightMenu(Context paramContext, ViewGroup paramViewGroup)
  {
    return null;
  }

  protected CharSequence getTitle(Context paramContext)
  {
    return "";
  }

  public boolean goBack()
  {
    if ((this.mParent != null) && (!(this.mParent.getContentFragment() instanceof WelcomeFragment)) && (needTray()))
    {
      WelcomeFragment localWelcomeFragment = new WelcomeFragment();
      Bundle localBundle = new Bundle();
      localBundle.putBoolean("LaunchedFromTray", true);
      localWelcomeFragment.setArguments(localBundle);
      this.mParent.mGoingBack = true;
      this.mParent.updateContentFragmentBack(localWelcomeFragment);
      return true;
    }
    return false;
  }

  protected boolean isUpdateTitle()
  {
    return this.mUpdateTitle;
  }

  protected boolean needAnimOnTitleBar()
  {
    return true;
  }

  protected boolean needTransparentActionBar()
  {
    return false;
  }

  protected boolean needTray()
  {
    return false;
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.mEventHandler = new EventHandler(null);
  }

  public void onPause()
  {
    super.onPause();
    try
    {
      this.mBus.unregister(this.mEventHandler);
      return;
    }
    catch (Exception localException)
    {
      L.W("No event handler to unregister");
    }
  }

  public void onResume()
  {
    super.onResume();
    this.mBus.register(this.mEventHandler);
    if (!UiUtil.isTablet(this.mParent))
    {
      this.mParent.showShoppingList(true);
      this.mParent.setListEnabled(true);
    }
    View localView1 = this.mParent.findViewById(2131624014);
    View localView2;
    if ((localView1 != null) && (UiUtil.isTablet(this.mParent)))
    {
      localView1.setVisibility(0);
      localView2 = localView1.findViewById(2131624362);
      if ((!needTransparentActionBar()) || (!(localView2 instanceof ImageView)))
        break label159;
      ((ImageView)localView2).setImageResource(2130837880);
    }
    while (true)
    {
      this.mParent.setSlShowing(true);
      if (this.mUpdateTitle)
        this.mParent.updateTitleBar(this, needTray(), needTransparentActionBar(), getTitle(this.mParent), getRightMenu(this.mParent, this.mParent.getRightMenuViewParent()), needAnimOnTitleBar());
      return;
      label159: if ((localView2 instanceof ImageView))
        ((ImageView)localView2).setImageResource(2130837879);
    }
  }

  public void onStop()
  {
    super.onStop();
  }

  protected void setUpdateTitle(boolean paramBoolean)
  {
    this.mUpdateTitle = paramBoolean;
  }

  protected void slEvent(boolean paramBoolean)
  {
  }

  private class EventHandler
  {
    private EventHandler()
    {
    }

    @Subscribe
    public void slClosed(SLEvent paramSLEvent)
    {
      ContentFragment.this.slEvent(paramSLEvent.open);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.fragments.ContentFragment
 * JD-Core Version:    0.6.2
 */