Search in sources :

Example 1 with CHECK_CARD_SELECTION

use of com.ichi2.async.CollectionTask.TASK_TYPE.CHECK_CARD_SELECTION in project AnkiChinaAndroid by ankichinateam.

the class CardBrowser method updateMultiselectMenu.

private void updateMultiselectMenu() {
    Timber.d("updateMultiselectMenu()");
    if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) {
        return;
    }
    if (!mCheckedCards.isEmpty()) {
        CollectionTask.cancelAllTasks(CHECK_CARD_SELECTION);
        CollectionTask.launchCollectionTask(CHECK_CARD_SELECTION, mCheckSelectedCardsHandler, new TaskData(new Object[] { mCheckedCards, getCards() }));
    }
    mActionBarMenu.findItem(R.id.action_select_all).setVisible(!hasSelectedAllCards());
    // Note: Theoretically should not happen, as this should kick us back to the menu
    mActionBarMenu.findItem(R.id.action_select_none).setVisible(hasSelectedCards());
    mActionBarMenu.findItem(R.id.action_edit_note).setVisible(canPerformMultiSelectEditNote());
}
Also used : JSONObject(com.ichi2.utils.JSONObject) TaskData(com.ichi2.async.TaskData)

Example 2 with CHECK_CARD_SELECTION

use of com.ichi2.async.CollectionTask.TASK_TYPE.CHECK_CARD_SELECTION in project AnkiChinaAndroid by ankichinateam.

the class SelfStudyActivity method updateMultiselectMenu.

private void updateMultiselectMenu() {
    Timber.d("updateMultiselectMenu()");
    if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) {
        return;
    }
    if (getSelectedCardIds().length != 0) {
        CollectionTask.cancelAllTasks(CHECK_CARD_SELECTION);
        CollectionTask.launchCollectionTask(CHECK_CARD_SELECTION, mCheckSelectedCardsHandler, new TaskData(new Object[] { getSelectedCards(), getCards() }));
    }
}
Also used : JSONObject(com.ichi2.utils.JSONObject) TaskData(com.ichi2.async.TaskData)

Aggregations

TaskData (com.ichi2.async.TaskData)2 JSONObject (com.ichi2.utils.JSONObject)2