kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Use BindableItem in PickerIconItem.
rodzic
a188125982
commit
e2dd058430
|
@ -1,20 +1,25 @@
|
|||
package org.schabi.newpipe.local.subscription.item
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||
import kotlinx.android.synthetic.main.picker_icon_item.icon_view
|
||||
import com.xwray.groupie.viewbinding.BindableItem
|
||||
import org.schabi.newpipe.R
|
||||
import org.schabi.newpipe.databinding.PickerIconItemBinding
|
||||
import org.schabi.newpipe.local.subscription.FeedGroupIcon
|
||||
|
||||
class PickerIconItem(context: Context, val icon: FeedGroupIcon) : Item() {
|
||||
class PickerIconItem(
|
||||
context: Context,
|
||||
val icon: FeedGroupIcon
|
||||
) : BindableItem<PickerIconItemBinding>() {
|
||||
@DrawableRes
|
||||
val iconRes: Int = icon.getDrawableRes(context)
|
||||
|
||||
override fun getLayout(): Int = R.layout.picker_icon_item
|
||||
|
||||
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||
viewHolder.icon_view.setImageResource(iconRes)
|
||||
override fun bind(viewBinding: PickerIconItemBinding, position: Int) {
|
||||
viewBinding.iconView.setImageResource(iconRes)
|
||||
}
|
||||
|
||||
override fun initializeViewBinding(view: View) = PickerIconItemBinding.bind(view)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue