package com.android.launcher3.provider;

import android.content.ContentProviderOperation;
import android.content.Context;
import android.content.OperationApplicationException;
import android.os.RemoteException;

import com.android.launcher3.util.ThreadpoolManager;

import java.util.ArrayList;

public class DBManager {


    public static void doSql(Context mContext, ArrayList<ContentProviderOperation> ops) {

        ThreadpoolManager.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                try {
                    if (!ops.isEmpty()) {
                        mContext.getContentResolver().applyBatch(ManagerAppProvider.AUTHORITY, ops);
                    }
                } catch (OperationApplicationException e) {
                    e.printStackTrace();
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        });
    }

}
