浏览代码

Minor cleanup

arkon 4 年之前
父节点
当前提交
8cd27a199d

+ 13 - 5
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<NetworkHelper>().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(
+            MangaThumbnail::class.java,
+            InputStream::class.java,
+            MangaThumbnailModelLoader.Factory()
+        )
         registry.append(
-            InputStream::class.java, InputStream::class.java,
-            PassthroughModelLoader
-                .Factory()
+            InputStream::class.java,
+            InputStream::class.java,
+            PassthroughModelLoader.Factory()
         )
     }
 }

+ 9 - 13
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<Manga> {
-        return Comparator { mangaFirst: Manga,
-            mangaSecond: Manga ->
-            compareValues(mangaSecond.last_update, mangaFirst.last_update)
+    private fun latestFirstRanking(): Comparator<Manga> =
+        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<Manga> {
-        return Comparator { mangaFirst: Manga,
-            mangaSecond: Manga ->
-            compareValues(mangaFirst.title, mangaSecond.title)
+    private fun lexicographicRanking(): Comparator<Manga> =
+        Comparator { first: Manga, second: Manga ->
+            compareValues(first.title, second.title)
         }
-    }
 }