Turns out I don't know how to spell manhwa

h before w
This commit is contained in:
Jay 2020-02-23 01:47:05 -08:00
parent 1da1b281eb
commit 4e922eff9f
6 changed files with 20 additions and 17 deletions

View File

@ -38,11 +38,11 @@ interface Manga : SManga {
return if (currentGenres()?.split(",")?.any return if (currentGenres()?.split(",")?.any
{ tag -> { tag ->
val trimmedTag = tag.trim().toLowerCase(Locale.US) val trimmedTag = tag.trim().toLowerCase(Locale.US)
trimmedTag == "long strip" || trimmedTag == "manwha" || trimmedTag == "long strip" || trimmedTag == "manhwa" ||
trimmedTag.contains("webtoon") trimmedTag.contains("webtoon")
} == true || } == true ||
sourceManager.getOrStub(source).name.contains("webtoon", true)) sourceManager.getOrStub(source).name.contains("webtoon", true))
TYPE_MANWHA TYPE_MANHWA
else TYPE_MANGA else TYPE_MANGA
} }
@ -97,7 +97,7 @@ interface Manga : SManga {
const val DISPLAY_MASK = 0x00100000 const val DISPLAY_MASK = 0x00100000
const val TYPE_MANGA = 1 const val TYPE_MANGA = 1
const val TYPE_MANWHA = 2 const val TYPE_MANHWA = 2
fun create(source: Long): Manga = MangaImpl().apply { fun create(source: Long): Manga = MangaImpl().apply {
this.source = source this.source = source

View File

@ -250,7 +250,7 @@ open class LibraryController(
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity) super.onActivityResumed(activity)
if (observeLater) { if (observeLater && !::presenter.isInitialized) {
presenter.getLibrary() presenter.getLibrary()
} }
} }
@ -258,10 +258,12 @@ open class LibraryController(
override fun onActivityPaused(activity: Activity) { override fun onActivityPaused(activity: Activity) {
super.onActivityPaused(activity) super.onActivityPaused(activity)
observeLater = true observeLater = true
if (!::presenter.isInitialized)
presenter.onDestroy() presenter.onDestroy()
} }
override fun onDestroy() { override fun onDestroy() {
if (!::presenter.isInitialized)
presenter.onDestroy() presenter.onDestroy()
super.onDestroy() super.onDestroy()
} }

View File

@ -170,9 +170,9 @@ class LibraryPresenter(
if (filterUnread == STATE_REALLY_EXCLUDE && item.manga.unread > 0) return@f false if (filterUnread == STATE_REALLY_EXCLUDE && item.manga.unread > 0) return@f false
if (filterMangaType == Manga.TYPE_MANGA && if (filterMangaType == Manga.TYPE_MANGA &&
item.manga.mangaType() == Manga.TYPE_MANWHA) item.manga.mangaType() == Manga.TYPE_MANHWA)
return@f false return@f false
if ((filterMangaType == Manga.TYPE_MANWHA) && if ((filterMangaType == Manga.TYPE_MANHWA) &&
item.manga.mangaType() == Manga.TYPE_MANGA) return@f false item.manga.mangaType() == Manga.TYPE_MANGA) return@f false

View File

@ -338,7 +338,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
} }
filter = preferences.filterMangaType().getOrDefault() filter = preferences.filterMangaType().getOrDefault()
if (filter > 0) { if (filter > 0) {
filters.add(if (filter == 1) R.string.manga_only else R.string.manwha_only) filters.add(if (filter == 1) R.string.manga_only else R.string.manhwa_only)
} }
return filters return filters
} }
@ -365,20 +365,20 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A
filter_layout.addView(it) filter_layout.addView(it)
} }
checkForManwha() checkForManhwa()
} }
private fun checkForManwha() { private fun checkForManhwa() {
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) { GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT) {
val db:DatabaseHelper by injectLazy() val db:DatabaseHelper by injectLazy()
val librryManga = db.getLibraryMangas().executeAsBlocking() val librryManga = db.getLibraryMangas().executeAsBlocking()
if (librryManga.any { it.mangaType() == Manga.TYPE_MANWHA }) { if (librryManga.any { it.mangaType() == Manga.TYPE_MANHWA }) {
launchUI { launchUI {
val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup
mangaType.setup( mangaType.setup(
this@SortFilterBottomSheet, this@SortFilterBottomSheet,
R.string.manga, R.string.manga,
R.string.manwha R.string.manhwa
) )
this@SortFilterBottomSheet.mangaType = mangaType this@SortFilterBottomSheet.mangaType = mangaType
filter_layout.addView(mangaType) filter_layout.addView(mangaType)

View File

@ -396,9 +396,10 @@ class ReaderPresenter(
val manga = manga ?: return preferences.defaultViewer() val manga = manga ?: return preferences.defaultViewer()
if (manga.viewer == -1) { if (manga.viewer == -1) {
val type = val type =
if (manga.mangaType() == Manga.TYPE_MANWHA) ReaderActivity.WEBTOON if (manga.mangaType() == Manga.TYPE_MANHWA) ReaderActivity.WEBTOON
else 0 else 0
setMangaViewer(type) manga.viewer = type
db.updateMangaViewer(manga).asRxObservable().subscribe()
} }
return if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer return if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
} }

View File

@ -6,7 +6,7 @@
<string name="name">Name</string> <string name="name">Name</string>
<string name="categories">Categories</string> <string name="categories">Categories</string>
<string name="manga">Manga</string> <string name="manga">Manga</string>
<string name="manwha">Manwha</string> <string name="manhwa">Manhwa</string>
<string name="chapters">Chapters</string> <string name="chapters">Chapters</string>
<string name="track">Tracking</string> <string name="track">Tracking</string>
<string name="history">History</string> <string name="history">History</string>
@ -47,7 +47,7 @@
<string name="action_hide_categories">Hide categories</string> <string name="action_hide_categories">Hide categories</string>
<string name="hiding_categories">Hiding categories</string> <string name="hiding_categories">Hiding categories</string>
<string name="manga_only">Manga only</string> <string name="manga_only">Manga only</string>
<string name="manwha_only">Manwha only</string> <string name="manhwa_only">Manhwa only</string>
<string name="action_unlock_trackers">Unlock to access trackers</string> <string name="action_unlock_trackers">Unlock to access trackers</string>
<string name="sorting_by_">Sorting by %1$s</string> <string name="sorting_by_">Sorting by %1$s</string>