mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:41:52 +01:00
Option to search series type in library
Works like a tag so "-Manga" for example excludes manga
This commit is contained in:
parent
1ab54487d1
commit
8163af217e
@ -54,9 +54,9 @@ interface Manga : SManga {
|
||||
|
||||
fun showChapterTitle(defaultShow: Boolean): Boolean = chapter_flags and DISPLAY_MASK == DISPLAY_NUMBER
|
||||
|
||||
fun seriesType(context: Context): String {
|
||||
fun seriesType(context: Context, sourceManager: SourceManager? = null): String {
|
||||
return context.getString(
|
||||
when (seriesType()) {
|
||||
when (seriesType(sourceManager = sourceManager)) {
|
||||
TYPE_WEBTOON -> R.string.webtoon
|
||||
TYPE_MANHWA -> R.string.manhwa
|
||||
TYPE_MANHUA -> R.string.manhua
|
||||
@ -79,8 +79,8 @@ interface Manga : SManga {
|
||||
/**
|
||||
* The type of comic the manga is (ie. manga, manhwa, manhua)
|
||||
*/
|
||||
fun seriesType(useOriginalTags: Boolean = false, customTags: String? = null): Int {
|
||||
val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
|
||||
fun seriesType(useOriginalTags: Boolean = false, customTags: String? = null, sourceManager: SourceManager? = null): Int {
|
||||
val sourceName by lazy { (sourceManager ?: Injekt.get()).getOrStub(source).name }
|
||||
val tags = customTags ?: if (useOriginalTags) originalGenre else genre
|
||||
val currentTags = tags?.split(",")?.map { it.trim().toLowerCase(Locale.US) } ?: emptyList()
|
||||
return if (currentTags.any { tag -> isMangaTag(tag) }) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.kanade.tachiyomi.ui.library
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -36,6 +35,7 @@ class LibraryItem(
|
||||
var downloadCount = -1
|
||||
var unreadType = 2
|
||||
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
private val uniformSize: Boolean
|
||||
get() = preferences.uniformGrid().get()
|
||||
|
||||
@ -160,16 +160,18 @@ class LibraryItem(
|
||||
} else containsGenre(constraint, manga.genre?.split(", "))
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
private fun containsGenre(tag: String, genres: List<String>?): Boolean {
|
||||
if (tag.trim().isEmpty()) return true
|
||||
return if (tag.startsWith("-")) {
|
||||
genres?.find {
|
||||
it.trim().equals(tag.substringAfter("-"), ignoreCase = true)
|
||||
val realTag = tag.substringAfter("-")
|
||||
it.trim().equals(realTag, ignoreCase = true) ||
|
||||
manga.seriesType(preferences.context, sourceManager).equals(realTag, true)
|
||||
} == null
|
||||
} else {
|
||||
genres?.find {
|
||||
it.trim().equals(tag, ignoreCase = true)
|
||||
it.trim().equals(tag, ignoreCase = true) ||
|
||||
manga.seriesType(preferences.context, sourceManager).equals(tag, true)
|
||||
} != null
|
||||
}
|
||||
}
|
||||
|
@ -286,9 +286,9 @@ class LibraryPresenter(
|
||||
|
||||
if (filterMangaType > 0) {
|
||||
if (if (filterMangaType == Manga.TYPE_MANHWA) {
|
||||
(filterMangaType != item.manga.seriesType() && filterMangaType != Manga.TYPE_WEBTOON)
|
||||
(filterMangaType != item.manga.seriesType(sourceManager = sourceManager) && filterMangaType != Manga.TYPE_WEBTOON)
|
||||
} else {
|
||||
filterMangaType != item.manga.seriesType()
|
||||
filterMangaType != item.manga.seriesType(sourceManager = sourceManager)
|
||||
}
|
||||
) return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user