Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the word order of some of the toast messages #12446

Merged
merged 4 commits into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import com.drakeet.drawer.FullDraggableContainer
import com.google.android.material.snackbar.Snackbar
import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anim.ActivityTransitionAnimation.getInverseTransition
import com.ichi2.anki.CollectionManager.TR
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.UIUtils.showThemedToast
import com.ichi2.anki.cardviewer.*
Expand Down Expand Up @@ -889,7 +890,7 @@ abstract class AbstractFlashcardViewer :
/** Consumers should use [.showDeleteNoteDialog] */
private fun deleteNoteWithoutConfirmation() {
dismiss(DeleteNote(currentCard!!)) {
showSnackbarWithUndoButton(R.string.deleted_note)
showSnackbarWithUndoButtonText(TR.browsingCardsDeleted(currentCard!!.note().numberOfCards()))
}
}

Expand All @@ -902,6 +903,15 @@ abstract class AbstractFlashcardViewer :
}
}

private fun showSnackbarWithUndoButtonText(
text: String,
duration: Int = Snackbar.LENGTH_SHORT
) {
showSnackbarAboveAnswerButtons(text, duration) {
setAction(R.string.undo) { undo() }
}
}

private fun getRecommendedEase(easy: Boolean): Int {
return try {
when (answerButtonCount) {
Expand Down Expand Up @@ -1632,25 +1642,26 @@ abstract class AbstractFlashcardViewer :

internal fun buryCard(): Boolean {
return dismiss(BuryCard(currentCard!!)) {
showSnackbarWithUndoButton(R.string.buried_card)
showSnackbarWithUndoButton(R.string.card_buried)
}
}

internal fun suspendCard(): Boolean {
return dismiss(SuspendCard(currentCard!!)) {
showSnackbarWithUndoButton(R.string.suspended_card)
showSnackbarWithUndoButtonText(TR.studyingCardSuspended())
}
}

internal fun suspendNote(): Boolean {
return dismiss(SuspendNote(currentCard!!)) {
showSnackbarWithUndoButton(R.string.suspended_note)
val noteSuspended = resources.getQuantityString(R.plurals.note_suspended, currentCard!!.note().numberOfCards(), currentCard!!.note().numberOfCards())
showSnackbarWithUndoButtonText(noteSuspended)
}
}

internal fun buryNote(): Boolean {
return dismiss(BuryNote(currentCard!!)) {
showSnackbarWithUndoButton(R.string.buried_note)
showSnackbarWithUndoButtonText(TR.studyingCardsBuried(currentCard!!.note().numberOfCards()))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class AboutFragment : Fragment() {
if (clipboardManager != null) {
clipboardManager.setPrimaryClip(ClipData.newPlainText("$appName v$pkgVersionName", debugInfo))
showSnackbar(
R.string.about_ankidroid_successfully_copied_debug,
R.string.about_ankidroid_successfully_copied_debug_info,
Snackbar.LENGTH_SHORT
)
} else {
Expand Down
19 changes: 10 additions & 9 deletions AnkiDroid/src/main/res/values/02-strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<string name="anki_js_error_code">(Error Code: %d)</string>

<!-- About AnkiDroid screen -->
<string name="about_ankidroid_successfully_copied_debug">Copied debug information to clipboard</string>
<string name="about_ankidroid_successfully_copied_debug_info">Copied to clipboard</string>
<string name="about_ankidroid_error_copy_debug_info">Error copying debug information to clipboard</string>

<!-- Card Viewer -->
Expand Down Expand Up @@ -382,12 +382,13 @@
<string name="search_using_deck_name">Search using deck name</string>
<string name="home">Home</string>

<!-- Reviewer actions -->
<string name="buried_card">Buried card</string>
<string name="buried_note">Buried note</string>
<string name="deleted_note">Deleted note</string>
<string name="suspended_card">Suspended card</string>
<string name="suspended_note">Suspended note</string>
<!-- Reviewer actions
Each of these strings ends with a period, following the notation of Anki Desktop -->
<string name="card_buried">Card buried.</string>
<plurals name="note_suspended">
<item quantity="one">%d card suspended.</item>
<item quantity="other">%d cards suspended.</item>
</plurals>

<!-- Note Editor Toggle Sticky -->
<string name="note_editor_toggle_sticky">Make field %s sticky</string>
Expand Down Expand Up @@ -441,8 +442,8 @@

<!-- Deck Creation -->
<string name="validation_deck_already_exists">Deck exists</string>
<string name="deck_created">Created deck</string>
<string name="deck_renamed">Renamed deck</string>
<string name="deck_created">Deck created</string>
<string name="deck_renamed">Deck renamed</string>

<!-- Deck Deletion -->
<string name="deck_shortcut_doesnt_exist">Deck deleted. Please remove the shortcut</string>
Expand Down