package com.splunk.mint;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import java.util.Calendar;
import java.util.TimeZone;

public class MintActivity extends Activity
{
  private static final String LASTMINTTIMESTAMP = "LASTMINTTIMESTAMP";
  private static SharedPreferences.Editor editor;
  private static SharedPreferences preferences;

  private void checkIFNeedToSendGnip(final Context paramContext)
  {
    new Thread(new Runnable()
    {
      public void run()
      {
        long l1 = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() / 1000L;
        long l2 = 0L;
        if (paramContext != null)
        {
          SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("Mint", 0);
          if (localSharedPreferences != null)
            l2 = localSharedPreferences.getLong("LASTPINGTIME", 0L) / 1000L;
        }
        if ((l2 > 0L) && (l1 - l2 > 300L))
        {
          ActionEvent.createGnip(MintActivity.getLastStop(paramContext)).save(new DataSaver());
          ActionEvent.createPing().send(new NetSender(), true);
        }
      }
    }).start();
  }

  public static Long getLastStop(Context paramContext)
  {
    try
    {
      initPreferences(paramContext);
      Long localLong = Long.valueOf(preferences.getLong("LASTMINTTIMESTAMP", 0L));
      return localLong;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  @SuppressLint({"CommitPrefEdits"})
  public static void initPreferences(Context paramContext)
  {
    try
    {
      if (preferences == null)
        preferences = PreferenceManager.getDefaultSharedPreferences(paramContext);
      if (editor == null)
        editor = preferences.edit();
      return;
    }
    finally
    {
    }
  }

  public static void setLastStop(Context paramContext)
  {
    try
    {
      new Thread(new Runnable()
      {
        public void run()
        {
          MintActivity.initPreferences(this.val$ctx);
          long l = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() / 1000L;
          MintActivity.editor.putLong("LASTMINTTIMESTAMP", l).commit();
        }
      }).start();
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void onResume()
  {
    super.onResume();
    new Thread(new Runnable()
    {
      public void run()
      {
        Properties.BATTERY_LEVEL = Utils.getBatteryLevel(MintActivity.this);
        Mint.logView(MintActivity.this.getClass().getName(), null);
        MintActivity.this.checkIFNeedToSendGnip(MintActivity.this);
      }
    }).start();
  }

  public void onStop()
  {
    super.onStop();
    setLastStop(this);
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.splunk.mint.MintActivity
 * JD-Core Version:    0.6.2
 */