Add function in interface to get list of genres
This commit is contained in:
parent
5cff247aa4
commit
42a97f8c40
3 changed files with 13 additions and 12 deletions
|
@ -28,6 +28,10 @@ interface Manga : SManga {
|
||||||
return chapter_flags and SORT_MASK == SORT_DESC
|
return chapter_flags and SORT_MASK == SORT_DESC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getGenres(): List<String>? {
|
||||||
|
return genre?.split(", ")?.map { it.trim() }
|
||||||
|
}
|
||||||
|
|
||||||
// Used to display the chapter's title one way or another
|
// Used to display the chapter's title one way or another
|
||||||
var displayMode: Int
|
var displayMode: Int
|
||||||
get() = chapter_flags and DISPLAY_MASK
|
get() = chapter_flags and DISPLAY_MASK
|
||||||
|
|
|
@ -70,10 +70,9 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
|
||||||
(manga.artist?.contains(constraint, true) ?: false) ||
|
(manga.artist?.contains(constraint, true) ?: false) ||
|
||||||
sourceManager.getOrStub(manga.source).name.contains(constraint, true) ||
|
sourceManager.getOrStub(manga.source).name.contains(constraint, true) ||
|
||||||
if (constraint.contains(",")) {
|
if (constraint.contains(",")) {
|
||||||
val genres = manga.genre?.split(", ")
|
constraint.split(",").all { containsGenre(it.trim(), manga.getGenres()) }
|
||||||
constraint.split(",").all { containsGenre(it.trim(), genres) }
|
|
||||||
} else {
|
} else {
|
||||||
containsGenre(constraint, manga.genre?.split(", "))
|
containsGenre(constraint, manga.getGenres())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,16 +245,14 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
if (!manga.genre.isNullOrBlank()) {
|
if (!manga.genre.isNullOrBlank()) {
|
||||||
binding.mangaGenresTags.removeAllViews()
|
binding.mangaGenresTags.removeAllViews()
|
||||||
|
|
||||||
manga.genre?.split(", ").orEmpty()
|
manga.getGenres()?.forEach { genre ->
|
||||||
.map { it.trim() }
|
val chip = Chip(view.context).apply {
|
||||||
.forEach { genre ->
|
text = genre
|
||||||
val chip = Chip(view.context).apply {
|
setOnClickListener { performSearch(genre) }
|
||||||
text = genre
|
|
||||||
setOnClickListener { performSearch(genre) }
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.mangaGenresTags.addView(chip)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.mangaGenresTags.addView(chip)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update description TextView.
|
// Update description TextView.
|
||||||
|
|
Reference in a new issue