package com.ikea.kompis.scan;

import android.app.ActionBar;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.AsyncTask;
import android.os.AsyncTask.Status;
import android.os.Bundle;
import com.ikea.kompis.BaseCustomFontActivity;
import com.ikea.kompis.util.UiUtil;
import com.ikea.shared.analytics.UsageTracker;
import com.ikea.shared.util.Constant;
import com.ikea.shared.util.L;
import com.metaio.sdk.MetaioDebug;
import com.metaio.tools.io.AssetsManager;
import java.io.IOException;

public class MainActivity extends BaseCustomFontActivity
{
  private static final String IS_FIRST_TIME_CALLED = "IS_FIRST_TIME_CALLED";
  public static final int REQUEST_CODE = 3048;
  private boolean isScanFirstTimeCalled = true;
  private AssetsExtracter mTask;

  protected Intent getBarcodeOcrRedaerIntent()
  {
    return new Intent(getApplicationContext(), BarcodeOCRReader.class);
  }

  protected int getGUILayout()
  {
    return 2130903101;
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    int i;
    int j;
    if (paramIntent != null)
      if (paramIntent.getBooleanExtra("FOR_MINI_PIP", false))
      {
        i = 2130968583;
        j = 2130968582;
      }
    while (true)
    {
      Constant.i().setOfflineToastNeedToShow(false);
      setResult(-1, paramIntent);
      finish();
      overridePendingTransition(i, j);
      return;
      i = 2130968587;
      j = 2130968584;
      continue;
      i = 2130968583;
      j = 2130968582;
    }
  }

  public void onBackPressed()
  {
    UsageTracker.i().setBackPressed();
    super.onBackPressed();
    if ((this.mTask != null) && (this.mTask.getStatus() == AsyncTask.Status.RUNNING))
    {
      this.mTask.cancel(true);
      this.mTask = null;
    }
  }

  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    UiUtil.applyLocaleString(this, false);
    super.onConfigurationChanged(paramConfiguration);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    UiUtil.applyLocaleString(this, false);
    setContentView(getGUILayout());
    if (!UiUtil.isTablet(this))
      setRequestedOrientation(1);
    getActionBar().hide();
    if ((paramBundle != null) && (paramBundle.containsKey("IS_FIRST_TIME_CALLED")))
      this.isScanFirstTimeCalled = paramBundle.getBoolean("IS_FIRST_TIME_CALLED");
    MetaioDebug.enableLogging(false);
    if (this.isScanFirstTimeCalled)
    {
      this.mTask = new AssetsExtracter(null);
      AssetsExtracter localAssetsExtracter = this.mTask;
      Integer[] arrayOfInteger = new Integer[1];
      arrayOfInteger[0] = Integer.valueOf(0);
      localAssetsExtracter.execute(arrayOfInteger);
      this.isScanFirstTimeCalled = false;
    }
  }

  protected void onSaveInstanceState(Bundle paramBundle)
  {
    super.onSaveInstanceState(paramBundle);
    paramBundle.putBoolean("IS_FIRST_TIME_CALLED", this.isScanFirstTimeCalled);
  }

  protected void openBarCodeActivity()
  {
    startActivityForResult(getBarcodeOcrRedaerIntent(), 3338);
    overridePendingTransition(0, 0);
  }

  private class AssetsExtracter extends AsyncTask<Integer, Integer, Boolean>
  {
    private AssetsExtracter()
    {
    }

    protected Boolean doInBackground(Integer[] paramArrayOfInteger)
    {
      try
      {
        Thread.sleep(500L);
        AssetsManager.extractAllAssets(MainActivity.this.getApplicationContext(), false);
        return Boolean.valueOf(true);
      }
      catch (InterruptedException localInterruptedException)
      {
        while (true)
          localInterruptedException.printStackTrace();
      }
      catch (IOException localIOException)
      {
        MetaioDebug.log(6, "Error extracting assets: " + localIOException.getMessage());
        MetaioDebug.printStackTrace(6, localIOException);
      }
      return Boolean.valueOf(false);
    }

    protected void onPostExecute(Boolean paramBoolean)
    {
      MainActivity.this.openBarCodeActivity();
    }

    protected void onPreExecute()
    {
      L.I("");
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.scan.MainActivity
 * JD-Core Version:    0.6.2
 */