diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt index 4c32691f1e..5faec1f030 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt +++ b/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() { + val sourceManager by injectLazy() + /** * Called when ViewHolder is created * @param parent parent View diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt index 07e18bfb58..9aa7c79de3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt +++ b/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() - 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))