Search in sources :

Example 1 with REQUEST_CODE_SPEAK_SETTING

use of com.ichi2.anki.SpeakSettingActivity.REQUEST_CODE_SPEAK_SETTING in project AnkiChinaAndroid by ankichinateam.

the class AbstractFlashcardViewer method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Timber.i("onActivityResult:" + requestCode);
    if (requestCode == BE_VIP || requestCode == REFRESH_LOGIN_STATE_AND_TURN_TO_VIP_HTML) {
        mRefreshVipStateOnResume = true;
        mTurnToVipHtml = requestCode == REFRESH_LOGIN_STATE_AND_TURN_TO_VIP_HTML;
    } else if (requestCode == REFRESH_VOICE_INFO) {
        mRefreshVoiceInfoStateOnResume = true;
    } else if (resultCode == DeckPicker.RESULT_DB_ERROR) {
        closeReviewer(DeckPicker.RESULT_DB_ERROR, false);
    } else if (resultCode == DeckPicker.RESULT_MEDIA_EJECTED) {
        finishNoStorageAvailable();
    } else if (requestCode == REFRESH_TOP_BUTTONS) {
        restorePreferences();
        supportInvalidateOptionsMenu();
        invalidateOptionsMenu();
    } else if (requestCode == REQUEST_CODE_SPEAK_SETTING) {
        restorePreferences();
        mReInitBDVoice = true;
    } else if (requestCode == REFRESH_GESTURE) {
        restorePreferences();
    } else if (requestCode == REFRESH_CONTROLLER) {
        restorePreferences();
    }
    /* Reset the schedule and reload the latest card off the top of the stack if required.
           The card could have been rescheduled, the deck could have changed, or a change of
           note type could have lead to the card being deleted */
    if (data != null && data.hasExtra("reloadRequired")) {
        performReload();
    }
    if (requestCode == EDIT_CURRENT_CARD) {
        if (resultCode == RESULT_OK) {
            // content of note was changed so update the note and current card
            Timber.i("AbstractFlashcardViewer:: Saving card...");
            CollectionTask.launchCollectionTask(UPDATE_NOTE, mUpdateCardHandler, new TaskData(sEditorCard, true));
            onEditedNoteChanged();
        } else if (resultCode == RESULT_CANCELED && !(data != null && data.hasExtra("reloadRequired"))) {
            // nothing was changed by the note editor so just redraw the card
            redrawCard();
        }
    } else if (requestCode == DECK_OPTIONS && resultCode == RESULT_OK) {
        performReload();
    }
    if (!mDisableClipboard) {
        clipboardSetText("");
    }
}
Also used : TaskData(com.ichi2.async.TaskData)

Aggregations

TaskData (com.ichi2.async.TaskData)1