Implement simple stats screen (#8068)
* Implement simple stats screen * Review Changes * Some other changes * Remove unused * Small changes * Review Changes 2 + Cleanup * Review Changes 3 * Cleanup leftovers * Optimize imports
This commit is contained in:
@@ -24,6 +24,7 @@ import okhttp3.OkHttpClient
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.domain.track.model.Track as DomainTrack
|
||||
|
||||
abstract class TrackService(val id: Long) {
|
||||
|
||||
@@ -59,6 +60,11 @@ abstract class TrackService(val id: Long) {
|
||||
|
||||
abstract fun getScoreList(): List<String>
|
||||
|
||||
// TODO: Store all scores as 10 point in the future maybe?
|
||||
open fun get10PointScore(track: DomainTrack): Float {
|
||||
return track.score
|
||||
}
|
||||
|
||||
open fun indexToScore(index: Int): Float {
|
||||
return index.toFloat()
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.domain.track.model.Track as DomainTrack
|
||||
|
||||
class Anilist(private val context: Context, id: Long) : TrackService(id) {
|
||||
|
||||
@@ -94,6 +95,11 @@ class Anilist(private val context: Context, id: Long) : TrackService(id) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun get10PointScore(track: DomainTrack): Float {
|
||||
// Score is stored in 100 point format
|
||||
return track.score / 10f
|
||||
}
|
||||
|
||||
override fun indexToScore(index: Int): Float {
|
||||
return when (scorePreference.get()) {
|
||||
// 10 point
|
||||
|
||||
Reference in New Issue
Block a user