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 ce289a4c6c..565ac3b8ee 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 @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.ui.recently_read -import android.support.v7.widget.RecyclerView import android.view.ViewGroup import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.R @@ -15,13 +14,15 @@ import eu.kanade.tachiyomi.util.inflate * @param fragment a RecentlyReadFragment object * @constructor creates an instance of the adapter. */ -class RecentlyReadAdapter(val fragment: RecentlyReadFragment) : FlexibleAdapter() { +class RecentlyReadAdapter(val fragment: RecentlyReadFragment) +: FlexibleAdapter() { + /** * Called when ViewHolder is created * @param parent parent View * @param viewType int containing viewType */ - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder? { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecentlyReadHolder { val view = parent.inflate(R.layout.item_recent_manga) return RecentlyReadHolder(view, this) } @@ -31,9 +32,9 @@ class RecentlyReadAdapter(val fragment: RecentlyReadFragment) : FlexibleAdapter< * @param holder bind holder * @param position position of holder */ - override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { - val item = getItem(position) as MangaChapterHistory - (holder as RecentlyReadHolder).onSetValues(item) + override fun onBindViewHolder(holder: RecentlyReadHolder, position: Int) { + val item = getItem(position) + holder.onSetValues(item) } /** 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 fbc7e6e22b..d70fdfcd31 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 @@ -22,8 +22,8 @@ import java.text.DecimalFormatSymbols * @param adapter the adapter handling this holder. * @constructor creates a new recent chapter holder. */ -class RecentlyReadHolder(view: View, private val adapter: RecentlyReadAdapter) : - RecyclerView.ViewHolder(view) { +class RecentlyReadHolder(view: View, private val adapter: RecentlyReadAdapter) +: RecyclerView.ViewHolder(view) { /** * DecimalFormat used to display correct chapter number diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt index 552409be20..c0b837c88f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt @@ -13,17 +13,20 @@ import java.text.SimpleDateFormat import java.util.* import javax.inject.Inject -/** - * The id of the restartable. - */ -const private val GET_RECENT_MANGA = 1 - /** * Presenter of RecentlyReadFragment. * Contains information and data for fragment. * Observable updates should be called from here. */ class RecentlyReadPresenter : BasePresenter() { + + companion object { + /** + * The id of the restartable. + */ + const private val GET_RECENT_MANGA = 1 + } + /** * Used to connect to database */ @@ -35,9 +38,9 @@ class RecentlyReadPresenter : BasePresenter() { // Used to get recent manga restartableLatestCache(GET_RECENT_MANGA, { getRecentMangaObservable() }, - { recentMangaFragment, manga -> + { view, manga -> // Update adapter to show recent manga's - recentMangaFragment.onNextManga(manga) + view.onNextManga(manga) } )