Searching in library now has genre searching

This commit is contained in:
Jay 2019-11-24 18:32:21 -08:00
parent 011510574d
commit 898792ce8e

View File

@ -59,7 +59,15 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
*/
override fun filter(constraint: String): Boolean {
return manga.title.contains(constraint, true) ||
(manga.author?.contains(constraint, true) ?: false)
(manga.author?.contains(constraint, true) ?: false) ||
(if (constraint.startsWith("-"))
manga.genre?.split(", ")?.find {
it.toLowerCase() == constraint.substringAfter("-").toLowerCase()
} == null
else
manga.genre?.split(", ")?.find {
it.toLowerCase() == constraint.toLowerCase() } != null
)
}
override fun equals(other: Any?): Boolean {