Allow adding multiple tags separated by commas (jobobby04/TachiyomiSY#1282)
(cherry picked from commit 41e523e074917759b7118a50deab062bd700060c)
This commit is contained in:
parent
45c85183d8
commit
34bb78ea0e
2 changed files with 12 additions and 6 deletions
|
|
@ -47,6 +47,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.binding
|
import eu.kanade.tachiyomi.widget.materialdialogs.binding
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.dismissDialog
|
import eu.kanade.tachiyomi.widget.materialdialogs.dismissDialog
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.setColors
|
import eu.kanade.tachiyomi.widget.materialdialogs.setColors
|
||||||
|
import eu.kanade.tachiyomi.widget.materialdialogs.setHint
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.setNegativeButton
|
import eu.kanade.tachiyomi.widget.materialdialogs.setNegativeButton
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.setPositiveButton
|
import eu.kanade.tachiyomi.widget.materialdialogs.setPositiveButton
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.setTextEdit
|
import eu.kanade.tachiyomi.widget.materialdialogs.setTextEdit
|
||||||
|
|
@ -433,7 +434,7 @@ private fun ChipGroup.setChips(
|
||||||
}
|
}
|
||||||
|
|
||||||
val addTagChip = Chip(context).apply {
|
val addTagChip = Chip(context).apply {
|
||||||
text = SYMR.strings.add_tag.getString(context)
|
text = SYMR.strings.add_tags.getString(context)
|
||||||
// KMK -->
|
// KMK -->
|
||||||
setTextColor(colors.tagTextColor)
|
setTextColor(colors.tagTextColor)
|
||||||
// KMK <--
|
// KMK <--
|
||||||
|
|
@ -456,12 +457,15 @@ private fun ChipGroup.setChips(
|
||||||
|
|
||||||
val builder = MaterialAlertDialogBuilder(context)
|
val builder = MaterialAlertDialogBuilder(context)
|
||||||
val binding = builder.binding(context)
|
val binding = builder.binding(context)
|
||||||
.setTitle(SYMR.strings.add_tag.getString(context))
|
.setTitle(SYMR.strings.add_tags.getString(context))
|
||||||
|
.setHint(SYMR.strings.multi_tags_comma_separated.getString(context))
|
||||||
.setPositiveButton(MR.strings.action_ok.getString(context)) {
|
.setPositiveButton(MR.strings.action_ok.getString(context)) {
|
||||||
dialog?.dismissDialog()
|
dialog?.dismissDialog()
|
||||||
// KMK <--
|
// KMK <--
|
||||||
val newTag = it.trimOrNull()
|
val newTags = it.trimOrNull()
|
||||||
if (newTag != null) setChips(items + listOfNotNull(newTag), scope, colors)
|
newTags?.let { tags ->
|
||||||
|
setChips(items + tags.split(",").mapNotNull { tag -> tag.trimOrNull() }, scope, colors)
|
||||||
|
}
|
||||||
// KMK -->
|
// KMK -->
|
||||||
}
|
}
|
||||||
.setNegativeButton(MR.strings.action_cancel.getString(context)) {
|
.setNegativeButton(MR.strings.action_cancel.getString(context)) {
|
||||||
|
|
@ -480,7 +484,7 @@ private fun ChipGroup.setChips(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ChipGroup.getTextStrings(): List<String> = children.mapNotNull {
|
private fun ChipGroup.getTextStrings(): List<String> = children.mapNotNull {
|
||||||
if (it is Chip && !it.text.toString().contains(context.stringResource(SYMR.strings.add_tag), ignoreCase = true)) {
|
if (it is Chip && !it.text.toString().contains(context.stringResource(SYMR.strings.add_tags), ignoreCase = true)) {
|
||||||
it.text.toString()
|
it.text.toString()
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|
|
||||||
|
|
@ -395,13 +395,14 @@
|
||||||
|
|
||||||
<!-- Entry Info Edit -->
|
<!-- Entry Info Edit -->
|
||||||
<string name="reset_tags">Reset Tags</string>
|
<string name="reset_tags">Reset Tags</string>
|
||||||
<string name="add_tag">Add Tag</string>
|
<string name="add_tags">Add Tags</string>
|
||||||
<string name="reset_info">Reset Info</string>
|
<string name="reset_info">Reset Info</string>
|
||||||
<string name="title_hint">Title: %1$s</string>
|
<string name="title_hint">Title: %1$s</string>
|
||||||
<string name="description_hint">Description: %1$s</string>
|
<string name="description_hint">Description: %1$s</string>
|
||||||
<string name="author_hint">Author: %1$s</string>
|
<string name="author_hint">Author: %1$s</string>
|
||||||
<string name="artist_hint">Artist: %1$s</string>
|
<string name="artist_hint">Artist: %1$s</string>
|
||||||
<string name="thumbnail_url_hint">Thumbnail Url: %1$s</string>
|
<string name="thumbnail_url_hint">Thumbnail Url: %1$s</string>
|
||||||
|
<string name="multi_tags_comma_separated">Enter tag(s), seperated by commas.</string>
|
||||||
|
|
||||||
<!-- Browse -->
|
<!-- Browse -->
|
||||||
<!-- Sources Tab -->
|
<!-- Sources Tab -->
|
||||||
|
|
@ -436,6 +437,7 @@
|
||||||
<string name="feed_add">Add %1$s to feed?</string>
|
<string name="feed_add">Add %1$s to feed?</string>
|
||||||
|
|
||||||
<!-- Sort by tags -->
|
<!-- Sort by tags -->
|
||||||
|
<string name="add_tag">Add Tag</string>
|
||||||
<string name="pref_tag_sorting">Tag sorting tags</string>
|
<string name="pref_tag_sorting">Tag sorting tags</string>
|
||||||
<string name="tag_sorting">Tag sorting</string>
|
<string name="tag_sorting">Tag sorting</string>
|
||||||
<string name="action_add_tags_message">Read this! Tags must be exact, there are no partial matches, you cannot do netorare to filter out female:netorare or similar!\nThe style for namespace tags is\n\"female: sole female\"\nwithout quotes!\nAdding multiple variants of the same tag is supported, so feel free to do \"tag: netorare\" for NHentai and \"female: netorare\" for E-Hentai!</string>
|
<string name="action_add_tags_message">Read this! Tags must be exact, there are no partial matches, you cannot do netorare to filter out female:netorare or similar!\nThe style for namespace tags is\n\"female: sole female\"\nwithout quotes!\nAdding multiple variants of the same tag is supported, so feel free to do \"tag: netorare\" for NHentai and \"female: netorare\" for E-Hentai!</string>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue