From 898792ce8e9721bf7cfe0f59bbe2d42a5c7c693c Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 24 Nov 2019 18:32:21 -0800 Subject: [PATCH] Searching in library now has genre searching --- .../java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt index 090aa26636..4e88d6f10b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt @@ -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 {