hl.java 2.99 KB
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.AsyncTask;
import android.support.annotation.UiThread;
import android.support.annotation.VisibleForTesting;
import com.bitstrips.imoji.persistence.MediaCacheTable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public final class hl
{
  public final SQLiteDatabase a;
  final hj b;
  public ArrayList<hk> c = new ArrayList();
  public boolean d = false;
  public AsyncTask e = null;
  
  public hl(SQLiteDatabase paramSQLiteDatabase, hj paramhj)
  {
    this.a = paramSQLiteDatabase;
    this.b = paramhj;
  }
  
  @UiThread
  final void a()
  {
    ArrayList localArrayList = this.c;
    this.e = new hl.a().execute(new List[] { localArrayList });
    this.c = new ArrayList();
  }
  
  @UiThread
  public final void a(hk paramhk)
  {
    if (this.d) {}
    do
    {
      return;
      this.c.add(paramhk);
    } while (this.e != null);
    a();
  }
  
  @VisibleForTesting
  final class a
    extends AsyncTask<List<hk>, Void, Void>
  {
    a() {}
    
    private Void a(List<hk>... paramVarArgs)
    {
      paramVarArgs = paramVarArgs[0];
      hl.this.a.beginTransaction();
      for (;;)
      {
        try
        {
          paramVarArgs = paramVarArgs.iterator();
          if (!paramVarArgs.hasNext()) {
            break label263;
          }
          localObject1 = (hk)paramVarArgs.next();
          switch (hl.1.a[(localObject1.a - 1)])
          {
          case 1: 
            localObject2 = hl.this.b;
            localSQLiteDatabase = hl.this.a;
            str = ((hk)localObject1).b;
            localObject1 = ((hk)localObject1).c;
            ContentValues localContentValues = new ContentValues();
            localContentValues.put("cache_key", str);
            localContentValues.put("url", (String)localObject1);
            localSQLiteDatabase.replace(((hj)localObject2).a.getName(), null, localContentValues);
            break;
          case 2: 
            localObject2 = hl.this.b;
          }
        }
        catch (SQLiteException paramVarArgs)
        {
          hl.this.a.endTransaction();
          return null;
        }
        SQLiteDatabase localSQLiteDatabase = hl.this.a;
        Object localObject1 = ((hk)localObject1).b;
        String str = String.format("%s = ?", new Object[] { "cache_key" });
        localSQLiteDatabase.delete(((hj)localObject2).a.getName(), str, new String[] { localObject1 });
        continue;
        localObject1 = hl.this.b;
        Object localObject2 = hl.this.a;
        try
        {
          ((SQLiteDatabase)localObject2).delete(((hj)localObject1).a.getName(), null, null);
        }
        catch (SQLiteException localSQLiteException) {}
        continue;
        label263:
        hl.this.a.setTransactionSuccessful();
      }
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/hl.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */