use of com.ichi2.anki.CardBrowser.Column.ANSWER in project Anki-Android by ankidroid.
the class AbstractFlashcardViewer method displayCardAnswer.
protected void displayCardAnswer() {
// #7294 Required in case the animation end action does not fire:
actualHideEaseButtons();
Timber.d("displayCardAnswer()");
mMissingImageHandler.onCardSideChange();
mBackButtonPressedToReturn = false;
// prevent answering (by e.g. gestures) before card is loaded
if (mCurrentCard == null) {
return;
}
// TODO needs testing: changing a card's model without flipping it back to the front
// (such as editing a card, then editing the card template)
mTypeAnswer.updateInfo(mCurrentCard, getResources());
// but sometimes failed to do so (e.g. if an OnKeyListener is attached).
if (mTypeAnswer.validForEditText()) {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(mAnswerField.getWindowToken(), 0);
}
sDisplayAnswer = true;
mSoundPlayer.stopSounds();
mAnswerField.setVisibility(View.GONE);
// Clean up the user answer and the correct answer
if (!mTypeAnswer.useInputTag()) {
mTypeAnswer.setInput(mAnswerField.getText().toString());
}
mIsSelecting = false;
CardHtml answerContent = mHtmlGenerator.generateHtml(mCurrentCard, false, Side.BACK);
updateCard(answerContent);
displayAnswerBottomBar();
mAutomaticAnswer.onDisplayAnswer();
// If Card-based TTS is enabled, we "automatic display" after the TTS has finished as we don't know the duration
if (!mTTS.isEnabled()) {
mAutomaticAnswer.scheduleAutomaticDisplayQuestion(mUseTimerDynamicMS);
}
}
use of com.ichi2.anki.CardBrowser.Column.ANSWER in project Anki-Android by ankidroid.
the class ImportTest method csvManualLineBreakExample.
@Test
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
public void csvManualLineBreakExample() throws IOException {
String file = Shared.getTestFilePath(getTestContext(), "text-anki-manual-csv-multi-line.txt");
TextImporter i = new TextImporter(mTestCol, file);
i.setAllowHtml(true);
i.initMapping();
i.run();
Note n = mTestCol.getNote(mTestCol.getDb().queryLongScalar("select id from notes"));
assertThat(Arrays.asList(n.getFields()), contains("hello", "this is\na two line answer"));
}
use of com.ichi2.anki.CardBrowser.Column.ANSWER in project Anki-Android by ankidroid.
the class OverviewStatsBuilderTest method testInfoHtmlStringLife.
@Test
@Config(qualifiers = "en")
public void testInfoHtmlStringLife() {
OverviewStatsBuilder statsTester = new OverviewStatsBuilder(new WebView(getTargetContext()), getCol(), 42L, Stats.AxisType.TYPE_LIFE);
String HTML = statsTester.createInfoHtmlString();
assertEquals(HTML, "<center><style>\n" + "h1, h3 { margin-bottom: 0; margin-top: 1em; text-transform: capitalize; }\n" + ".pielabel { text-align:center; padding:0px; color:white; }\n" + "body {color:#FFFFFF;}\n" + "</style><h1>Today</h1>Studied <b>0 cards</b> in <b>0 minutes</b> today<br>Again count: <b>0</b><br>Learn: <b>0</b>, review: <b>0</b>, relearn: <b>0</b>, filtered: <b>0</b><br>No mature cards were studied today<h1>deck life</h1><h3>FORECAST</h3>Total: <b>0</b> reviews<br>Average: <b>0.0</b> reviews/day<br>Due tomorrow: <b>0</b><br><h3>REVIEW COUNT</h3>Days studied: <b>0%</b> (0 of 1)<br>Total: <b>0</b> reviews<br>Average for days studied: <b>0.0</b> reviews/day<br>If you studied every day: <b>0.0</b> reviews/day<br><h3>REVIEW TIME</h3>Days studied: <b>0%</b> (0 of 1)<br>Total: <b>0</b> minutes<br>Average for days studied: <b>0.0</b> minutes/day<br>If you studied every day: <b>0.0</b> minutes/day<br>Average answer time: <b>0.0s</b> (<b>0.00</b> cards/minute)<br><h3>ADDED</h3>Total: <b>0</b> cards<br>Average: <b>0.0</b> cards/day<br><h3>INTERVALS</h3>Average interval: <b>0.0</b> hours<br>Longest interval: <b>0.0</b> hours<h3>ANSWER BUTTONS</h3>Learning: <b>0.00%</b> correct (0 of 0)<br>Young: <b>0.00%</b> correct (0 of 0)<br>Mature: <b>0.00%</b> correct (0 of 0)<h3>CARD TYPES</h3>Total cards: <b>0</b><br>Total notes: <b>0</b><br>Lowest ease: <b>0%</b><br>Average ease: <b>0%</b><br>Highest ease: <b>0%</b></center>");
}
use of com.ichi2.anki.CardBrowser.Column.ANSWER in project Anki-Android by ankidroid.
the class OverviewStatsBuilderTest method testInfoHtmlStringYear.
@Test
@Config(qualifiers = "en")
public void testInfoHtmlStringYear() {
OverviewStatsBuilder statsTester = new OverviewStatsBuilder(new WebView(getTargetContext()), getCol(), 42L, Stats.AxisType.TYPE_YEAR);
String HTML = statsTester.createInfoHtmlString();
assertEquals(HTML, "<center><style>\n" + "h1, h3 { margin-bottom: 0; margin-top: 1em; text-transform: capitalize; }\n" + ".pielabel { text-align:center; padding:0px; color:white; }\n" + "body {color:#FFFFFF;}\n" + "</style><h1>Today</h1>Studied <b>0 cards</b> in <b>0 minutes</b> today<br>Again count: <b>0</b><br>Learn: <b>0</b>, review: <b>0</b>, relearn: <b>0</b>, filtered: <b>0</b><br>No mature cards were studied today<h1>1 year</h1><h3>FORECAST</h3>Total: <b>0</b> reviews<br>Average: <b>0.0</b> reviews/day<br>Due tomorrow: <b>0</b><br><h3>REVIEW COUNT</h3>Days studied: <b>0%</b> (0 of 365)<br>Total: <b>0</b> reviews<br>Average for days studied: <b>0.0</b> reviews/day<br>If you studied every day: <b>0.0</b> reviews/day<br><h3>REVIEW TIME</h3>Days studied: <b>0%</b> (0 of 365)<br>Total: <b>0</b> minutes<br>Average for days studied: <b>0.0</b> minutes/day<br>If you studied every day: <b>0.0</b> minutes/day<br>Average answer time: <b>0.0s</b> (<b>0.00</b> cards/minute)<br><h3>ADDED</h3>Total: <b>0</b> cards<br>Average: <b>0.0</b> cards/day<br><h3>INTERVALS</h3>Average interval: <b>0.0</b> hours<br>Longest interval: <b>0.0</b> hours<h3>ANSWER BUTTONS</h3>Learning: <b>0.00%</b> correct (0 of 0)<br>Young: <b>0.00%</b> correct (0 of 0)<br>Mature: <b>0.00%</b> correct (0 of 0)<h3>CARD TYPES</h3>Total cards: <b>0</b><br>Total notes: <b>0</b><br>Lowest ease: <b>0%</b><br>Average ease: <b>0%</b><br>Highest ease: <b>0%</b></center>");
}
Aggregations