Skip to content
Closed
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
22 changes: 14 additions & 8 deletions AnkiDroid/src/main/java/com/ichi2/anki/dialogs/CreateDeckDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ class CreateDeckDialog(
setView(R.layout.dialog_generic_text_input)
}.input(prefill = initialDeckName, displayKeyboard = true, waitForPositiveButton = false) { dialog, text ->

val textInputLayout = dialog.getInputTextLayout()

val hintRes =
when (deckDialogType) {
DeckDialogType.DECK -> R.string.create_new_deck
DeckDialogType.SUB_DECK -> R.string.create_new_sub_deck
DeckDialogType.RENAME_DECK -> R.string.rename_deck
DeckDialogType.FILTERED_DECK -> R.string.filter_deck
}

textInputLayout.hint = context.getString(hintRes)

// defining the action of done button in ImeKeyBoard and enter button in physical keyBoard
val inputField = dialog.getInputField()
inputField.setOnEditorActionListener { _, actionId, event ->
Expand All @@ -121,16 +133,10 @@ class CreateDeckDialog(
onPositiveButtonClicked()
}
text.isBlank() -> {
dialog.getInputTextLayout().showSnackbar(
context.getString(R.string.empty_deck_name),
Snackbar.LENGTH_SHORT,
)
displayFeedback(context.getString(R.string.empty_deck_name))
}
else -> {
dialog.getInputTextLayout().showSnackbar(
context.getString(R.string.deck_already_exists),
Snackbar.LENGTH_SHORT,
)
displayFeedback(context.getString(R.string.deck_already_exists))
}
}
true
Expand Down
4 changes: 4 additions & 0 deletions AnkiDroid/src/main/res/values/02-strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<string name="edit_occlusions">Edit Occlusions</string>
<string name="paste_from_clipboard" maxLength="28">Paste from clipboard</string>

<string name="create_new_deck">New deck</string>
<string name="create_new_sub_deck">New sub deck</string>
<string name="filter_deck">Filter deck</string>

<string name="tag_name">Tag name</string>
<string name="add_new_filter_tags">Add/filter tags</string>
<string name="add_tag" maxLength="28">Add tag</string>
Expand Down
Loading