use of com.ichi2.anki.cardviewer.Gesture in project AnkiChinaAndroid by ankichinateam.
the class AbstractFlashcardViewer method answerCard.
protected void answerCard(@Consts.BUTTON_TYPE int ease) {
if (mInAnswer) {
return;
}
mIsSelecting = false;
hideLookupButton();
int buttonNumber = getCol().getSched().answerButtons(mCurrentCard);
// Detect invalid ease for current card (e.g. by using keyboard shortcut or gesture).
if (buttonNumber < ease) {
return;
}
// Set the dots appearing below the toolbar
switch(ease) {
case EASE_1:
mChosenAnswer.setText("\u2022");
mChosenAnswer.setTextColor(ContextCompat.getColor(this, R.color.material_red_500));
break;
case EASE_2:
mChosenAnswer.setText("\u2022\u2022");
mChosenAnswer.setTextColor(ContextCompat.getColor(this, buttonNumber == Consts.BUTTON_FOUR ? R.color.material_blue_grey_600 : R.color.material_green_500));
break;
case EASE_3:
mChosenAnswer.setText("\u2022\u2022\u2022");
mChosenAnswer.setTextColor(ContextCompat.getColor(this, buttonNumber == Consts.BUTTON_FOUR ? R.color.material_green_500 : R.color.material_light_blue_500));
break;
case EASE_4:
mChosenAnswer.setText("\u2022\u2022\u2022\u2022");
mChosenAnswer.setTextColor(ContextCompat.getColor(this, R.color.material_light_blue_500));
break;
default:
Timber.w("Unknown easy type %s", ease);
break;
}
// remove chosen answer hint after a while
mTimerHandler.removeCallbacks(removeChosenAnswerText);
mTimerHandler.postDelayed(removeChosenAnswerText, mShowChosenAnswerLength);
mSoundPlayer.stopSounds();
stopOnlineSpeaking();
mCurrentEase = ease;
CollectionTask.launchCollectionTask(ANSWER_CARD, mAnswerCardHandler(true), new TaskData(mCurrentCard, mCurrentEase));
}
use of com.ichi2.anki.cardviewer.Gesture in project Anki-Android by ankidroid.
the class AbstractFlashcardViewer method answerCard.
protected void answerCard(@Consts.BUTTON_TYPE int ease) {
if (mInAnswer) {
return;
}
mIsSelecting = false;
int buttonNumber = getCol().getSched().answerButtons(mCurrentCard);
// Detect invalid ease for current card (e.g. by using keyboard shortcut or gesture).
if (buttonNumber < ease) {
return;
}
// Temporarily sets the answer indicator dots appearing below the toolbar
mPreviousAnswerIndicator.displayAnswerIndicator(ease, buttonNumber);
mSoundPlayer.stopSounds();
mCurrentEase = ease;
new SchedulerService.AnswerAndGetCard(mCurrentCard, mCurrentEase).runWithHandler(answerCardHandler(true));
}
use of com.ichi2.anki.cardviewer.Gesture in project Anki-Android by ankidroid.
the class ReviewerNoParamTest method disableGestures.
private void disableGestures(Gesture... gestures) {
Editor settings = AnkiDroidApp.getSharedPrefs(getTargetContext()).edit();
for (Gesture g : gestures) {
String k = getKey(g);
settings.putString(k, ViewerCommand.COMMAND_NOTHING.toPreferenceString());
}
settings.apply();
}
Aggregations