package com.ikea.kompis.extendedcontent;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.ikea.kompis.scan.MainActivity;

public class ECMainActivity extends MainActivity
{
  protected String FIRST_TIME_SCAN = "firsttimescan";
  private TextView mScanStatusText;
  private TextView mScan_header;
  private AlertDialog mShowScanHelpDialog;

  private SharedPreferences getSharedPreferences()
  {
    return getSharedPreferences("preference_file_key", 0);
  }

  private void initHelpPopup()
  {
    if ((this.mShowScanHelpDialog != null) && (this.mShowScanHelpDialog.isShowing()))
      return;
    View localView = LayoutInflater.from(this).inflate(2130903134, null, false);
    localView.findViewById(2131624347).setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ECMainActivity.this.mShowScanHelpDialog.dismiss();
        ECMainActivity.this.openBarCodeActivity();
      }
    });
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setView(localView);
    localBuilder.setCancelable(true);
    this.mShowScanHelpDialog = localBuilder.create();
    this.mShowScanHelpDialog.setOnCancelListener(new DialogInterface.OnCancelListener()
    {
      public void onCancel(DialogInterface paramAnonymousDialogInterface)
      {
        ECMainActivity.this.openBarCodeActivity();
      }
    });
    setFirstTimeScan();
    this.mShowScanHelpDialog.show();
  }

  private void showHelpPopUp()
  {
    initHelpPopup();
  }

  protected Intent getBarcodeOcrRedaerIntent()
  {
    return new Intent(getApplicationContext(), ECBarcodeActivity.class);
  }

  protected int getGUILayout()
  {
    return 2130903075;
  }

  protected boolean isItfirstTimeScan()
  {
    return getSharedPreferences().getBoolean(this.FIRST_TIME_SCAN, true);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.mScan_header = ((TextView)findViewById(2131624037));
    this.mScanStatusText = ((TextView)findViewById(2131624038));
    setLayoutContent();
  }

  protected void openBarCodeActivity()
  {
    if (isItfirstTimeScan())
    {
      showHelpPopUp();
      return;
    }
    startActivityForResult(getBarcodeOcrRedaerIntent(), 3338);
    overridePendingTransition(0, 0);
  }

  protected void setFirstTimeScan()
  {
    SharedPreferences.Editor localEditor = getSharedPreferences().edit();
    localEditor.putBoolean(this.FIRST_TIME_SCAN, false);
    localEditor.commit();
  }

  protected void setLayoutContent()
  {
    if (new ECCountryUtils().isECEnabledInCurrentStore(this))
    {
      this.mScan_header.setText(getString(2131165776));
      this.mScanStatusText.setText(getString(2131165769));
      return;
    }
    this.mScan_header.setText(getString(2131165598));
    this.mScanStatusText.setText(2131165631);
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.extendedcontent.ECMainActivity
 * JD-Core Version:    0.6.2
 */