2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
|
|
|
import android.support.v7.widget.RecyclerView
|
|
|
|
import android.view.View
|
|
|
|
|
2018-12-01 00:02:18 +01:00
|
|
|
import jp.juggler.util.LogCategory
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-11-15 23:08:11 +01:00
|
|
|
internal class TabletColumnViewHolder(
|
|
|
|
activity : ActMain,
|
|
|
|
viewRoot : View
|
|
|
|
) : RecyclerView.ViewHolder(viewRoot) {
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
companion object {
|
|
|
|
val log = LogCategory("TabletColumnViewHolder")
|
|
|
|
}
|
|
|
|
|
|
|
|
val columnViewHolder : ColumnViewHolder
|
|
|
|
|
|
|
|
private var pageIndex = - 1
|
|
|
|
|
|
|
|
init {
|
|
|
|
columnViewHolder = ColumnViewHolder(activity, viewRoot)
|
2018-11-24 08:04:42 +01:00
|
|
|
// viewRoot.findViewById<View>(R.id.vTabletDivider).visibility = View.VISIBLE
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fun bind(column : Column, pageIndex : Int, column_count : Int) {
|
|
|
|
log.d("bind. %d => %d ", this.pageIndex, pageIndex)
|
|
|
|
|
|
|
|
columnViewHolder.onPageDestroy(this.pageIndex)
|
|
|
|
|
|
|
|
this.pageIndex = pageIndex
|
|
|
|
|
|
|
|
columnViewHolder.onPageCreate(column, pageIndex, column_count)
|
|
|
|
|
|
|
|
if(! column.bFirstInitialized) {
|
|
|
|
column.startLoading()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fun onViewRecycled() {
|
|
|
|
log.d("onViewRecycled %d", pageIndex)
|
|
|
|
columnViewHolder.onPageDestroy(pageIndex)
|
|
|
|
}
|
|
|
|
}
|