mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:15:14 +01:00
Remove unneeded casts
This commit is contained in:
parent
7039216eae
commit
93fc5944f3
@ -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<RecyclerView.ViewHolder, Any>() {
|
||||
class RecentlyReadAdapter(val fragment: RecentlyReadFragment)
|
||||
: FlexibleAdapter<RecentlyReadHolder, MangaChapterHistory>() {
|
||||
|
||||
/**
|
||||
* 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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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<RecentlyReadFragment>() {
|
||||
|
||||
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<RecentlyReadFragment>() {
|
||||
// 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)
|
||||
}
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user