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