use of com.ichi2.async.CollectionTask.TASK_TYPE.UPDATE_NOTE in project AnkiChinaAndroid by ankichinateam.
the class CardBrowser method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// FIXME:
Timber.d("onActivityResult(requestCode=%d, resultCode=%d)", requestCode, resultCode);
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == DeckPicker.RESULT_DB_ERROR) {
closeCardBrowser(DeckPicker.RESULT_DB_ERROR);
}
if (requestCode == EDIT_CARD && resultCode != RESULT_CANCELED) {
Timber.i("CardBrowser:: CardBrowser: Saving card...");
CollectionTask.launchCollectionTask(UPDATE_NOTE, updateCardHandler(), new TaskData(sCardBrowserCard, false));
} else if (requestCode == ADD_NOTE && resultCode == RESULT_OK) {
if (mSearchView != null) {
mSearchTerms = mSearchView.getQuery().toString();
searchCards();
} else {
Timber.w("Note was added from browser and on return mSearchView == null");
}
}
// Previewing can now perform an "edit", so it can pass on a reloadRequired
if (requestCode == PREVIEW_CARDS && data != null && (data.getBooleanExtra("reloadRequired", false) || data.getBooleanExtra("noteChanged", false))) {
searchCards();
if (getReviewerCardId() == mCurrentCardId) {
mReloadRequired = true;
}
}
if (requestCode == EDIT_CARD && data != null && (data.getBooleanExtra("reloadRequired", false) || data.getBooleanExtra("noteChanged", false))) {
// if reloadRequired or noteChanged flag was sent from note editor then reload card list
searchCards();
// in use by reviewer?
if (getReviewerCardId() == mCurrentCardId) {
mReloadRequired = true;
}
}
// maybe the availability of undo changed
invalidateOptionsMenu();
}
use of com.ichi2.async.CollectionTask.TASK_TYPE.UPDATE_NOTE in project AnkiChinaAndroid by ankichinateam.
the class SelfStudyActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// FIXME:
Timber.d("onActivityResult(requestCode=%d, resultCode=%d)", requestCode, resultCode);
if (data != null) {
Timber.d("onActivityResult data (reloadRequired=%s, noteChanged=%s)", data.getBooleanExtra("reloadRequired", false), data.getBooleanExtra("noteChanged", false));
}
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == DeckPicker.RESULT_DB_ERROR) {
closeCardBrowser(DeckPicker.RESULT_DB_ERROR);
}
if (requestCode == EDIT_CARD && resultCode != RESULT_CANCELED) {
Timber.i("CardBrowser:: CardBrowser: Saving card...");
CollectionTask.launchCollectionTask(UPDATE_NOTE, updateCardHandler(), new TaskData(sCardBrowserCard, false));
} else if (requestCode == ADD_NOTE && resultCode == RESULT_OK) {
if (mSearchView != null) {
mSearchTerms = mSearchView.getQuery().toString();
searchCards();
} else {
Timber.w("Note was added from browser and on return mSearchView == null");
}
}
// }
if (requestCode == PREVIEW_CARDS && data != null && (data.getBooleanExtra("reloadRequired", false) || data.getBooleanExtra("noteChanged", false))) {
searchCards();
if (getReviewerCardId() == mCurrentCardId) {
mReloadRequired = true;
}
}
if (requestCode == EDIT_CARD && data != null && (data.getBooleanExtra("reloadRequired", false) || data.getBooleanExtra("noteChanged", false))) {
// if reloadRequired or noteChanged flag was sent from note editor then reload card list
searchCards();
// in use by reviewer?
if (getReviewerCardId() == mCurrentCardId) {
mReloadRequired = true;
}
}
// maybe the availability of undo changed
invalidateOptionsMenu();
}
use of com.ichi2.async.CollectionTask.TASK_TYPE.UPDATE_NOTE 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("");
}
}
Aggregations