浏览代码

Minor changes

len 8 年之前
父节点
当前提交
987473df44

+ 4 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt

@@ -4,7 +4,9 @@ import android.view.ViewGroup
 import eu.davidea.flexibleadapter.FlexibleAdapter
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory
+import eu.kanade.tachiyomi.data.source.SourceManager
 import eu.kanade.tachiyomi.util.inflate
+import uy.kohesive.injekt.injectLazy
 
 /**
  * Adapter of RecentlyReadHolder.
@@ -17,6 +19,8 @@ import eu.kanade.tachiyomi.util.inflate
 class RecentlyReadAdapter(val fragment: RecentlyReadFragment)
 : FlexibleAdapter<RecentlyReadHolder, MangaChapterHistory>() {
 
+    val sourceManager by injectLazy<SourceManager>()
+
     /**
      * Called when ViewHolder is created
      * @param parent parent View

+ 1 - 5
app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt

@@ -7,10 +7,8 @@ import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory
-import eu.kanade.tachiyomi.data.source.SourceManager
 import kotlinx.android.synthetic.main.dialog_remove_recently.view.*
 import kotlinx.android.synthetic.main.item_recently_read.view.*
-import uy.kohesive.injekt.injectLazy
 import java.text.DateFormat
 import java.text.DecimalFormat
 import java.text.DecimalFormatSymbols
@@ -33,8 +31,6 @@ class RecentlyReadHolder(view: View, private val adapter: RecentlyReadAdapter)
      */
     private val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols().apply { decimalSeparator = '.' })
 
-    private val sourceManager by injectLazy<SourceManager>()
-
     private val df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)
 
     /**
@@ -54,7 +50,7 @@ class RecentlyReadHolder(view: View, private val adapter: RecentlyReadAdapter)
         // Set source + chapter title
         val formattedNumber = decimalFormat.format(chapter.chapter_number.toDouble())
         itemView.manga_source.text = itemView.context.getString(R.string.recent_manga_source)
-                .format(sourceManager.get(manga.source)?.name, formattedNumber)
+                .format(adapter.sourceManager.get(manga.source)?.name, formattedNumber)
 
         // Set last read timestamp title
         itemView.last_read.text = df.format(Date(history.last_read))