Use BindableItem in PickerIconItem.

pull/5029/head
Isira Seneviratne 2020-11-28 14:03:26 +05:30
rodzic a188125982
commit e2dd058430
1 zmienionych plików z 11 dodań i 6 usunięć

Wyświetl plik

@ -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)
}