From 8cd27a199d0a1a5635c78390f454b2c46ebc7062 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 16 May 2020 10:00:22 -0400 Subject: [PATCH] Minor cleanup --- .../tachiyomi/data/glide/TachiGlideModule.kt | 18 ++++++++++----- .../data/library/LibraryUpdateRanker.kt | 22 ++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt b/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt index 9e83370f53..2182fa8687 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt @@ -36,12 +36,20 @@ class TachiGlideModule : AppGlideModule() { override fun registerComponents(context: Context, glide: Glide, registry: Registry) { val networkFactory = OkHttpUrlLoader.Factory(Injekt.get().client) - registry.replace(GlideUrl::class.java, InputStream::class.java, networkFactory) - registry.append(MangaThumbnail::class.java, InputStream::class.java, MangaThumbnailModelLoader.Factory()) + registry.replace( + GlideUrl::class.java, + InputStream::class.java, + networkFactory + ) registry.append( - InputStream::class.java, InputStream::class.java, - PassthroughModelLoader - .Factory() + MangaThumbnail::class.java, + InputStream::class.java, + MangaThumbnailModelLoader.Factory() + ) + registry.append( + InputStream::class.java, + InputStream::class.java, + PassthroughModelLoader.Factory() ) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt index 651a391ee4..172e1463e6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt @@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.data.library 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 { @@ -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 * inactive [Manga] mInactive. @@ -21,23 +21,19 @@ object LibraryUpdateRanker { * Using this insight, function returns a Comparator for which mActive appears before mInactive. * @return a Comparator that ranks manga based on relevance. */ - fun latestFirstRanking(): Comparator { - return Comparator { mangaFirst: Manga, - mangaSecond: Manga -> - compareValues(mangaSecond.last_update, mangaFirst.last_update) + private fun latestFirstRanking(): Comparator = + Comparator { first: Manga, second: Manga -> + compareValues(second.last_update, first.last_update) } - } /** - * Provides a total ordering over all the Mangas. + * Provides a total ordering over all the [Manga]s. * * Order the manga lexicographically. * @return a Comparator that ranks manga lexicographically based on the title. */ - fun lexicographicRanking(): Comparator { - return Comparator { mangaFirst: Manga, - mangaSecond: Manga -> - compareValues(mangaFirst.title, mangaSecond.title) + private fun lexicographicRanking(): Comparator = + Comparator { first: Manga, second: Manga -> + compareValues(first.title, second.title) } - } }