2018-01-17 18:39:16 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
2019-02-15 02:51:22 +01:00
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
2018-01-17 18:39:16 +01:00
|
|
|
import android.view.View
|
|
|
|
import android.widget.Button
|
|
|
|
import android.widget.TextView
|
2019-04-04 04:10:42 +02:00
|
|
|
import jp.juggler.subwaytooter.api.entity.TootAccountRef
|
2018-01-17 18:39:16 +01:00
|
|
|
import jp.juggler.subwaytooter.table.SavedAccount
|
2018-12-01 00:02:18 +01:00
|
|
|
import jp.juggler.util.LogCategory
|
|
|
|
import jp.juggler.util.scan
|
2018-01-17 18:39:16 +01:00
|
|
|
|
|
|
|
internal abstract class ViewHolderHeaderBase(val activity : ActMain, val viewRoot : View) :
|
2019-02-15 02:51:22 +01:00
|
|
|
androidx.recyclerview.widget.RecyclerView.ViewHolder(viewRoot) {
|
2018-01-17 18:39:16 +01:00
|
|
|
|
|
|
|
companion object {
|
|
|
|
private val log = LogCategory("HeaderViewHolderBase")
|
|
|
|
}
|
|
|
|
|
|
|
|
internal lateinit var column : Column
|
|
|
|
internal lateinit var access_info : SavedAccount
|
|
|
|
|
|
|
|
init {
|
2018-01-21 13:46:36 +01:00
|
|
|
viewRoot.scan { v ->
|
2018-01-17 18:39:16 +01:00
|
|
|
try {
|
|
|
|
if(v is Button) {
|
|
|
|
// ボタンは太字なので触らない
|
|
|
|
} else if(v is TextView) {
|
2018-08-22 03:05:54 +02:00
|
|
|
v.typeface = ActMain.timeline_font
|
2018-01-17 18:39:16 +01:00
|
|
|
if(! activity.timeline_font_size_sp.isNaN()) {
|
|
|
|
v.textSize = activity.timeline_font_size_sp
|
|
|
|
}
|
2019-10-22 20:56:24 +02:00
|
|
|
|
|
|
|
val fv = activity.timeline_spacing
|
|
|
|
if( fv != null) v.setLineSpacing(0f,fv)
|
2018-01-17 18:39:16 +01:00
|
|
|
}
|
|
|
|
} catch(ex : Throwable) {
|
|
|
|
log.trace(ex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal open fun bindData(column : Column) {
|
|
|
|
this.column = column
|
|
|
|
this.access_info = column.access_info
|
|
|
|
}
|
|
|
|
|
|
|
|
internal abstract fun showColor()
|
|
|
|
|
|
|
|
internal abstract fun onViewRecycled()
|
2019-04-04 04:10:42 +02:00
|
|
|
|
|
|
|
internal open fun getAccount() : TootAccountRef? = null
|
2018-01-17 18:39:16 +01:00
|
|
|
}
|