Minor cleanup
This commit is contained in:
parent
772929b5c6
commit
8cd27a199d
2 changed files with 22 additions and 18 deletions
|
@ -36,12 +36,20 @@ class TachiGlideModule : AppGlideModule() {
|
||||||
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
|
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
|
||||||
val networkFactory = OkHttpUrlLoader.Factory(Injekt.get<NetworkHelper>().client)
|
val networkFactory = OkHttpUrlLoader.Factory(Injekt.get<NetworkHelper>().client)
|
||||||
|
|
||||||
registry.replace(GlideUrl::class.java, InputStream::class.java, networkFactory)
|
registry.replace(
|
||||||
registry.append(MangaThumbnail::class.java, InputStream::class.java, MangaThumbnailModelLoader.Factory())
|
GlideUrl::class.java,
|
||||||
|
InputStream::class.java,
|
||||||
|
networkFactory
|
||||||
|
)
|
||||||
registry.append(
|
registry.append(
|
||||||
InputStream::class.java, InputStream::class.java,
|
MangaThumbnail::class.java,
|
||||||
PassthroughModelLoader
|
InputStream::class.java,
|
||||||
.Factory()
|
MangaThumbnailModelLoader.Factory()
|
||||||
|
)
|
||||||
|
registry.append(
|
||||||
|
InputStream::class.java,
|
||||||
|
InputStream::class.java,
|
||||||
|
PassthroughModelLoader.Factory()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.data.library
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class will provide various functions to Rank mangas to efficiently schedule mangas to update.
|
* This class will provide various functions to rank manga to efficiently schedule manga to update.
|
||||||
*/
|
*/
|
||||||
object LibraryUpdateRanker {
|
object LibraryUpdateRanker {
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ object LibraryUpdateRanker {
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a total ordering over all the Mangas.
|
* Provides a total ordering over all the [Manga]s.
|
||||||
*
|
*
|
||||||
* Assumption: An active [Manga] mActive is expected to have been last updated after an
|
* Assumption: An active [Manga] mActive is expected to have been last updated after an
|
||||||
* inactive [Manga] mInactive.
|
* inactive [Manga] mInactive.
|
||||||
|
@ -21,23 +21,19 @@ object LibraryUpdateRanker {
|
||||||
* Using this insight, function returns a Comparator for which mActive appears before mInactive.
|
* Using this insight, function returns a Comparator for which mActive appears before mInactive.
|
||||||
* @return a Comparator that ranks manga based on relevance.
|
* @return a Comparator that ranks manga based on relevance.
|
||||||
*/
|
*/
|
||||||
fun latestFirstRanking(): Comparator<Manga> {
|
private fun latestFirstRanking(): Comparator<Manga> =
|
||||||
return Comparator { mangaFirst: Manga,
|
Comparator { first: Manga, second: Manga ->
|
||||||
mangaSecond: Manga ->
|
compareValues(second.last_update, first.last_update)
|
||||||
compareValues(mangaSecond.last_update, mangaFirst.last_update)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a total ordering over all the Mangas.
|
* Provides a total ordering over all the [Manga]s.
|
||||||
*
|
*
|
||||||
* Order the manga lexicographically.
|
* Order the manga lexicographically.
|
||||||
* @return a Comparator that ranks manga lexicographically based on the title.
|
* @return a Comparator that ranks manga lexicographically based on the title.
|
||||||
*/
|
*/
|
||||||
fun lexicographicRanking(): Comparator<Manga> {
|
private fun lexicographicRanking(): Comparator<Manga> =
|
||||||
return Comparator { mangaFirst: Manga,
|
Comparator { first: Manga, second: Manga ->
|
||||||
mangaSecond: Manga ->
|
compareValues(first.title, second.title)
|
||||||
compareValues(mangaFirst.title, mangaSecond.title)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue