diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupReorderItem.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupReorderItem.kt index e56bb408c..48b06b08a 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupReorderItem.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupReorderItem.kt @@ -1,16 +1,15 @@ package org.schabi.newpipe.local.subscription.item import android.view.MotionEvent +import android.view.View import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper.DOWN import androidx.recyclerview.widget.ItemTouchHelper.UP -import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder -import com.xwray.groupie.kotlinandroidextensions.Item -import kotlinx.android.synthetic.main.feed_group_reorder_item.group_icon -import kotlinx.android.synthetic.main.feed_group_reorder_item.group_name -import kotlinx.android.synthetic.main.feed_group_reorder_item.handle +import com.xwray.groupie.viewbinding.BindableItem +import com.xwray.groupie.viewbinding.GroupieViewHolder import org.schabi.newpipe.R import org.schabi.newpipe.database.feed.model.FeedGroupEntity +import org.schabi.newpipe.databinding.FeedGroupReorderItemBinding import org.schabi.newpipe.local.subscription.FeedGroupIcon data class FeedGroupReorderItem( @@ -18,7 +17,7 @@ data class FeedGroupReorderItem( val name: String, val icon: FeedGroupIcon, val dragCallback: ItemTouchHelper -) : Item() { +) : BindableItem() { constructor (feedGroupEntity: FeedGroupEntity, dragCallback: ItemTouchHelper) : this(feedGroupEntity.uid, feedGroupEntity.name, feedGroupEntity.icon, dragCallback) @@ -31,12 +30,12 @@ data class FeedGroupReorderItem( override fun getLayout(): Int = R.layout.feed_group_reorder_item - override fun bind(viewHolder: GroupieViewHolder, position: Int) { - viewHolder.group_name.text = name - viewHolder.group_icon.setImageResource(icon.getDrawableRes(viewHolder.containerView.context)) - viewHolder.handle.setOnTouchListener { _, event -> + override fun bind(viewBinding: FeedGroupReorderItemBinding, position: Int) { + viewBinding.groupName.text = name + viewBinding.groupIcon.setImageResource(icon.getDrawableRes(viewBinding.root.context)) + viewBinding.handle.setOnTouchListener { _, event -> if (event.actionMasked == MotionEvent.ACTION_DOWN) { - dragCallback.startDrag(viewHolder) + dragCallback.startDrag(GroupieViewHolder(viewBinding)) return@setOnTouchListener true } @@ -47,4 +46,6 @@ data class FeedGroupReorderItem( override fun getDragDirs(): Int { return UP or DOWN } + + override fun initializeViewBinding(view: View) = FeedGroupReorderItemBinding.bind(view) }