Search in sources :

Example 6 with TaskListener

use of com.ichi2.async.TaskListener in project AnkiChinaAndroid by ankichinateam.

the class TemporaryModel method saveToDatabase.

public void saveToDatabase(TaskListener listener) {
    Timber.d("saveToDatabase() called");
    dumpChanges();
    TemporaryModel.clearTempModelFiles();
    TaskData args = new TaskData(new Object[] { mEditedModel, getAdjustedTemplateChanges() });
    CollectionTask.launchCollectionTask(SAVE_MODEL, listener, args);
}
Also used : TaskData(com.ichi2.async.TaskData)

Example 7 with TaskListener

use of com.ichi2.async.TaskListener in project AnkiChinaAndroid by ankichinateam.

the class DeckPicker method mediaCheck.

public void mediaCheck() {
    TaskListener listener = mediaCheckListener();
    CollectionTask.launchCollectionTask(CHECK_MEDIA, listener);
}
Also used : TaskListener(com.ichi2.async.TaskListener)

Example 8 with TaskListener

use of com.ichi2.async.TaskListener in project AnkiChinaAndroid by ankichinateam.

the class DeckPickerFragment method updateDeckList.

public void updateDeckList(boolean quick) {
    // CollectionHelper.getInstance().closeCollection(true,"refresh");
    TaskListener listener = updateDeckListListener();
    CollectionTask.TASK_TYPE taskType = quick ? LOAD_DECK_QUICK : LOAD_DECK_COUNTS;
    CollectionTask.launchCollectionTask(taskType, listener);
}
Also used : TaskListener(com.ichi2.async.TaskListener) CollectionTask(com.ichi2.async.CollectionTask)

Example 9 with TaskListener

use of com.ichi2.async.TaskListener in project AnkiChinaAndroid by ankichinateam.

the class DeckPickerFragment method undo.

private void undo() {
    Timber.i("undo()");
    String undoReviewString = getResources().getString(R.string.undo_action_review);
    final boolean isReview = undoReviewString.equals(getCol().undoName(getResources()));
    TaskListener listener = undoTaskListener(isReview);
    CollectionTask.launchCollectionTask(UNDO, listener);
}
Also used : TaskListener(com.ichi2.async.TaskListener)

Example 10 with TaskListener

use of com.ichi2.async.TaskListener in project AnkiChinaAndroid by ankichinateam.

the class AnkiActivity method deleteDeck.

public void deleteDeck(final long did) {
    try {
        TaskListener listener = deleteDeckListener(did);
        CollectionTask.launchCollectionTask(DELETE_DECK, listener, new TaskData(did));
    } catch (Exception e) {
    }
}
Also used : TaskListener(com.ichi2.async.TaskListener) JSONException(com.ichi2.utils.JSONException) IOException(java.io.IOException) ActivityNotFoundException(android.content.ActivityNotFoundException) DeckRenameException(com.ichi2.anki.exception.DeckRenameException) TaskData(com.ichi2.async.TaskData)

Aggregations

TaskListener (com.ichi2.async.TaskListener)10 TaskData (com.ichi2.async.TaskData)6 CollectionTask (com.ichi2.async.CollectionTask)2 Deck (com.ichi2.libanki.Deck)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 AnkiActivity (com.ichi2.anki.AnkiActivity)1 DeckRenameException (com.ichi2.anki.exception.DeckRenameException)1 TASK_TYPE (com.ichi2.async.CollectionTask.TASK_TYPE)1 DeckTask (com.ichi2.async.DeckTask)1 TaskData (com.ichi2.async.DeckTask.TaskData)1 TaskListener (com.ichi2.async.DeckTask.TaskListener)1 Collection (com.ichi2.libanki.Collection)1 JSONArray (com.ichi2.utils.JSONArray)1 JSONException (com.ichi2.utils.JSONException)1 IOException (java.io.IOException)1