Search in sources :

Example 1 with NotificationDeleteTask

use of com.odysee.app.tasks.lbryinc.NotificationDeleteTask in project odysee-android by OdyseeTeam.

the class MainActivity method handleDeleteSelectedNotifications.

private void handleDeleteSelectedNotifications(List<LbryNotification> notifications) {
    List<Long> remoteIds = new ArrayList<>();
    for (LbryNotification notification : notifications) {
        remoteIds.add(notification.getRemoteId());
    }
    (new AsyncTask<Void, Void, Void>() {

        protected Void doInBackground(Void... params) {
            try {
                SQLiteDatabase db = dbHelper.getWritableDatabase();
                DatabaseHelper.deleteNotifications(notifications, db);
            } catch (Exception ex) {
            // pass
            }
            return null;
        }
    }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    new NotificationDeleteTask(remoteIds).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    if (notificationListAdapter != null) {
        notificationListAdapter.removeNotifications(notifications);
    }
    if (actionMode != null) {
        actionMode.finish();
    }
}
Also used : NotificationDeleteTask(com.odysee.app.tasks.lbryinc.NotificationDeleteTask) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) ArrayList(java.util.ArrayList) AsyncTask(android.os.AsyncTask) LbryNotification(com.odysee.app.model.lbryinc.LbryNotification) JSONException(org.json.JSONException) LbryUriException(com.odysee.app.exceptions.LbryUriException) ExecutionException(java.util.concurrent.ExecutionException) SQLiteException(android.database.sqlite.SQLiteException) LbryioRequestException(com.odysee.app.exceptions.LbryioRequestException) LbryioResponseException(com.odysee.app.exceptions.LbryioResponseException) ApiCallException(com.odysee.app.exceptions.ApiCallException) AuthTokenInvalidatedException(com.odysee.app.exceptions.AuthTokenInvalidatedException) ParseException(java.text.ParseException)

Aggregations

SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 SQLiteException (android.database.sqlite.SQLiteException)1 AsyncTask (android.os.AsyncTask)1 ApiCallException (com.odysee.app.exceptions.ApiCallException)1 AuthTokenInvalidatedException (com.odysee.app.exceptions.AuthTokenInvalidatedException)1 LbryUriException (com.odysee.app.exceptions.LbryUriException)1 LbryioRequestException (com.odysee.app.exceptions.LbryioRequestException)1 LbryioResponseException (com.odysee.app.exceptions.LbryioResponseException)1 LbryNotification (com.odysee.app.model.lbryinc.LbryNotification)1 NotificationDeleteTask (com.odysee.app.tasks.lbryinc.NotificationDeleteTask)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 JSONException (org.json.JSONException)1