Fixed blank title when refreshing metadata

This commit is contained in:
Jay 2020-02-01 11:47:48 -08:00
parent 2c33040a5f
commit 94b82ee40e
5 changed files with 15 additions and 36 deletions

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.data.database.models
import eu.kanade.tachiyomi.source.model.SManga
import java.lang.Exception
open class MangaImpl : Manga {
@ -38,16 +37,14 @@ open class MangaImpl : Manga {
override var hide_title: Boolean = false
override fun copyFrom(other: SManga) {
try {
if (other.title != title) {
title = if (currentTitle() != originalTitle()) {
val customTitle = currentTitle()
val trueTitle = other.title
"${customTitle}${SManga.splitter}${trueTitle}"
} else other.title
}
if (other is MangaImpl && (other as MangaImpl)::title.isInitialized && !other.title
.isBlank()) {
title = if (currentTitle() != originalTitle()) {
val customTitle = currentTitle()
val trueTitle = other.title
"${customTitle}${SManga.splitter}${trueTitle}"
} else other.title
}
catch(e: Exception) { }
super.copyFrom(other)
}

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.source.model
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import java.io.Serializable
interface SManga : Serializable {
@ -100,7 +101,7 @@ interface SManga : Serializable {
const val splitter = "▒ ▒∩▒"
fun create(): SManga {
return SMangaImpl()
return MangaImpl()
}
}

View File

@ -1,23 +0,0 @@
package eu.kanade.tachiyomi.source.model
class SMangaImpl : SManga {
override lateinit var url: String
override lateinit var title: String
override var artist: String? = null
override var author: String? = null
override var description: String? = null
override var genre: String? = null
override var status: Int = 0
override var thumbnail_url: String? = null
override var initialized: Boolean = false
}

View File

@ -247,7 +247,7 @@ class LibraryPresenter(
}
else -> sortAlphabetical(i1, i2)
}
if ((category.mangaSort!! - 'a') % 2 == 1 )
if ((category.mangaSort?.minus('a')) ?: 0 % 2 == 1 )
sort *= -1
sort
}

View File

@ -217,7 +217,11 @@ class MangaInfoPresenter(
else {
var changed = false
val title = title?.trim()
if (title.isNullOrBlank() && manga.currentTitle() != manga.originalTitle()) {
if (!title.isNullOrBlank() && manga.originalTitle().isBlank()) {
manga.title = title
changed = true
}
else if (title.isNullOrBlank() && manga.currentTitle() != manga.originalTitle()) {
manga.title = manga.originalTitle()
changed = true
} else if (!title.isNullOrBlank() && title != manga.currentTitle()) {