diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt index 8fce9b705..04c25c002 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdates.kt @@ -52,11 +52,18 @@ class MangaUpdates(private val context: Context, id: Int) : TrackService(id) { override fun getCompletionStatus(): Int = COMPLETE_LIST - override fun getScoreList(): List = (0..10).map(Int::toString) + private val _scoreList = (0..9).flatMap { i -> (0..9).map { j -> "$i.$j" } } + listOf("10.0") - override fun displayScore(track: Track): String = track.score.toInt().toString() + override fun getScoreList(): List = _scoreList + + override fun indexToScore(index: Int): Float = _scoreList[index].toFloat() + + override fun displayScore(track: Track): String = track.score.toString() override suspend fun update(track: Track, didReadChapter: Boolean): Track { + if (track.status != COMPLETE_LIST && didReadChapter) { + track.status = READING_LIST + } api.updateSeriesListItem(track) return track } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdatesApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdatesApi.kt index 1cc28b7a4..9e7404d08 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdatesApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/MangaUpdatesApi.kt @@ -125,7 +125,7 @@ class MangaUpdatesApi( suspend fun updateSeriesRating(track: Track) { if (track.score != 0f) { val body = buildJsonObject { - put("rating", track.score.toInt()) + put("rating", track.score) } authClient.newCall( PUT( diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Rating.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Rating.kt index 0de945dd3..b550a37f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Rating.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Rating.kt @@ -5,11 +5,11 @@ import kotlinx.serialization.Serializable @Serializable data class Rating( - val rating: Int? = null, + val rating: Float? = null, ) fun Rating.copyTo(track: Track): Track { return track.apply { - this.score = rating?.toFloat() ?: 0f + this.score = rating ?: 0f } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Record.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Record.kt index 6790290aa..60dc5f0cb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Record.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/mangaupdates/dto/Record.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.data.track.mangaupdates.dto import eu.kanade.tachiyomi.data.track.model.TrackSearch +import eu.kanade.tachiyomi.util.lang.htmlDecode import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -25,10 +26,10 @@ data class Record( fun Record.toTrackSearch(id: Int): TrackSearch { return TrackSearch.create(id).apply { media_id = this@toTrackSearch.seriesId ?: 0L - title = this@toTrackSearch.title ?: "" + title = this@toTrackSearch.title?.htmlDecode() ?: "" total_chapters = 0 cover_url = this@toTrackSearch.image?.url?.original ?: "" - summary = this@toTrackSearch.description ?: "" + summary = this@toTrackSearch.description?.htmlDecode() ?: "" tracking_url = this@toTrackSearch.url ?: "" publishing_status = "" publishing_type = this@toTrackSearch.type.toString() diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt index d03cb92ca..d75195076 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt @@ -1,5 +1,7 @@ package eu.kanade.tachiyomi.util.lang +import android.os.Build +import android.text.Html import net.greypanther.natsort.CaseInsensitiveSimpleNaturalComparator import java.nio.charset.StandardCharsets import kotlin.math.floor @@ -57,3 +59,14 @@ fun String.takeBytes(n: Int): String { bytes.decodeToString(endIndex = n).replace("\uFFFD", "") } } + +/** + * HTML-decode the string + */ +fun String.htmlDecode(): String { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY).toString() + } else { + Html.fromHtml(this).toString() + } +}