package com.ikea.kompis.fragments;

import android.app.Activity;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
import com.ikea.kompis.ShoppingCartActivity;
import com.ikea.kompis.fragments.event.ShowLegalNoticeEvent;
import com.ikea.shared.AppConfigData;
import com.ikea.shared.AppConfigManager;
import com.ikea.shared.analytics.UsageTracker;
import com.ikea.shared.util.IOUtils;
import com.squareup.otto.Bus;
import java.io.IOException;
import java.io.InputStream;

public class InformationFragment extends ContentFragment
{
  private boolean mLaunchedFromTray;
  private final View.OnClickListener mOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      default:
        return;
      case 2131624172:
        InformationFragment.this.getUrlFromConfigAndOpen("RecallInformation");
        return;
      case 2131624173:
        InformationFragment.this.getUrlFromConfigAndOpen("PrivacyPolicy");
        return;
      case 2131624174:
      }
      InformationFragment.this.mBus.post(new ShowLegalNoticeEvent());
    }
  };

  private void getUrlFromConfigAndOpen(String paramString)
  {
    String str = "";
    if ((AppConfigManager.i(getActivity()) != null) && (AppConfigManager.i(getActivity()).getAppConfigData() != null))
      str = AppConfigManager.i(getActivity()).getAppConfigData().getInformationUrl(paramString);
    if (!str.isEmpty())
      com.ikea.kompis.util.UiUtil.launchExternalApplication(this.mParent, str);
  }

  private String getVersion()
  {
    InputStream localInputStream = null;
    try
    {
      localInputStream = this.mParent.getResources().getAssets().open("svn_version.txt");
      String str = IOUtils.readAll(localInputStream);
      return str;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return "";
    }
    finally
    {
      IOUtils.closeQuietly(localInputStream);
    }
  }

  private SpannableString getVersionName()
  {
    String str = com.ikea.shared.util.UiUtil.getVersionName(this.mParent);
    SpannableString localSpannableString = new SpannableString(getString(2131165723) + " " + str);
    localSpannableString.setSpan(new StyleSpan(1), 0, -1 + getString(2131165723).length(), 33);
    return localSpannableString;
  }

  public static InformationFragment newInstance(boolean paramBoolean)
  {
    InformationFragment localInformationFragment = new InformationFragment();
    Bundle localBundle = new Bundle();
    localBundle.putBoolean("LaunchedFromTray", paramBoolean);
    localInformationFragment.setArguments(localBundle);
    return localInformationFragment;
  }

  protected CharSequence getTitle(Context paramContext)
  {
    return getActivity().getResources().getString(2131165410);
  }

  protected boolean needTray()
  {
    return this.mLaunchedFromTray;
  }

  public void onAttach(Activity paramActivity)
  {
    super.onAttach(paramActivity);
    Bundle localBundle = getArguments();
    if ((localBundle != null) && (localBundle.containsKey("LaunchedFromTray")))
      this.mLaunchedFromTray = localBundle.getBoolean("LaunchedFromTray");
  }

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    View localView1 = paramLayoutInflater.inflate(2130903096, paramViewGroup, false);
    View localView2 = localView1.findViewById(2131624172);
    String str1 = getString(2131165567).substring(0, 1).toUpperCase() + getString(2131165567).substring(1);
    ((TextView)localView2.findViewById(2131624049)).setText(str1);
    localView2.setOnClickListener(this.mOnClickListener);
    View localView3 = localView1.findViewById(2131624173);
    String str2 = getString(2131165556).substring(0, 1).toUpperCase() + getString(2131165556).substring(1).toLowerCase();
    ((TextView)localView3.findViewById(2131624049)).setText(str2);
    localView3.setOnClickListener(this.mOnClickListener);
    View localView4 = localView1.findViewById(2131624174);
    String str3 = getString(2131165432).substring(0, 1).toUpperCase() + getString(2131165432).substring(1).toLowerCase();
    ((TextView)localView4.findViewById(2131624049)).setText(str3);
    localView4.setOnClickListener(this.mOnClickListener);
    ((TextView)localView1.findViewById(2131624175)).setText(getVersion());
    ((TextView)localView1.findViewById(2131624176)).setText(getVersionName());
    return localView1;
  }

  public void onResume()
  {
    super.onResume();
    if (!com.ikea.kompis.util.UiUtil.isTablet(this.mParent))
      this.mParent.hideSL();
    while (true)
    {
      if (UsageTracker.i().isBackPressed())
        UsageTracker.i().viewInformation(getActivity());
      return;
      if (!this.mLaunchedFromTray)
        this.mParent.hideSL();
    }
  }

  protected void slEvent(boolean paramBoolean)
  {
    if ((!paramBoolean) && (UsageTracker.i().isBackPressed()))
      UsageTracker.i().viewInformation(getActivity());
  }
}

/* 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.InformationFragment
 * JD-Core Version:    0.6.2
 */