mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-11 13:07:45 +01:00
78689e7443
* Migrate to AndroidX (automatic conversion by Android Studio) * AndroidX dependency code updates * Fix source preference reparenting * fixes the androidx prefererences icon spacing issue (cherry picked from commit b76a15d960ec2cdf771be16377db0348b66b3179) * Fix source preference screen heading size/list padding Co-authored-by: Carlos <cargo8005@gmail.com>
35 lines
916 B
Kotlin
35 lines
916 B
Kotlin
package eu.kanade.tachiyomi.widget
|
|
|
|
import androidx.viewpager.widget.PagerAdapter
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
|
|
abstract class ViewPagerAdapter : PagerAdapter() {
|
|
|
|
protected abstract fun createView(container: ViewGroup, position: Int): View
|
|
|
|
protected open fun destroyView(container: ViewGroup, position: Int, view: View) {
|
|
}
|
|
|
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
val view = createView(container, position)
|
|
container.addView(view)
|
|
return view
|
|
}
|
|
|
|
override fun destroyItem(container: ViewGroup, position: Int, obj: Any) {
|
|
val view = obj as View
|
|
destroyView(container, position, view)
|
|
container.removeView(view)
|
|
}
|
|
|
|
override fun isViewFromObject(view: View, obj: Any): Boolean {
|
|
return view === obj
|
|
}
|
|
|
|
interface PositionableView {
|
|
val item: Any
|
|
}
|
|
|
|
}
|