/** * Check that no other sync-related jobs are queued, and that goodreads is authorized for this app * * @return Flag indicating OK */ private boolean checkCanSendToGoodreads() { if (BcQueueManager.getQueueManager().hasActiveTasks(BcQueueManager.CAT_GOODREADS_EXPORT_ALL)) { Toast.makeText(this, R.string.requested_task_is_already_queued, Toast.LENGTH_LONG).show(); return false; } if (BcQueueManager.getQueueManager().hasActiveTasks(BcQueueManager.CAT_GOODREADS_IMPORT_ALL)) { Toast.makeText(this, R.string.import_task_is_already_queued, Toast.LENGTH_LONG).show(); return false; } return checkGoodreadsAuth(); }
/** Start a background task that imports books from goodreads. */ private void importAllFromGoodreads(boolean isSync) { if (BcQueueManager.getQueueManager().hasActiveTasks(BcQueueManager.CAT_GOODREADS_IMPORT_ALL)) { Toast.makeText(this, R.string.requested_task_is_already_queued, Toast.LENGTH_LONG).show(); return; } if (BcQueueManager.getQueueManager().hasActiveTasks(BcQueueManager.CAT_GOODREADS_EXPORT_ALL)) { Toast.makeText(this, R.string.export_task_is_already_queued, Toast.LENGTH_LONG).show(); return; } if (!checkGoodreadsAuth()) return; QueueManager.getQueueManager() .enqueueTask(new ImportAllTask(isSync), BcQueueManager.QUEUE_MAIN, 0); Toast.makeText( AdministrationFunctions.this, R.string.task_has_been_queued_in_background, Toast.LENGTH_LONG) .show(); }