kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Use BindableItem in FeedGroupCardItem.
rodzic
b387946d34
commit
ee94b296ae
|
@ -1,18 +1,17 @@
|
||||||
package org.schabi.newpipe.local.subscription.item
|
package org.schabi.newpipe.local.subscription.item
|
||||||
|
|
||||||
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
import android.view.View
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.viewbinding.BindableItem
|
||||||
import kotlinx.android.synthetic.main.feed_group_card_item.icon
|
|
||||||
import kotlinx.android.synthetic.main.feed_group_card_item.title
|
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.database.feed.model.FeedGroupEntity
|
import org.schabi.newpipe.database.feed.model.FeedGroupEntity
|
||||||
|
import org.schabi.newpipe.databinding.FeedGroupCardItemBinding
|
||||||
import org.schabi.newpipe.local.subscription.FeedGroupIcon
|
import org.schabi.newpipe.local.subscription.FeedGroupIcon
|
||||||
|
|
||||||
data class FeedGroupCardItem(
|
data class FeedGroupCardItem(
|
||||||
val groupId: Long = FeedGroupEntity.GROUP_ALL_ID,
|
val groupId: Long = FeedGroupEntity.GROUP_ALL_ID,
|
||||||
val name: String,
|
val name: String,
|
||||||
val icon: FeedGroupIcon
|
val icon: FeedGroupIcon
|
||||||
) : Item() {
|
) : BindableItem<FeedGroupCardItemBinding>() {
|
||||||
constructor (feedGroupEntity: FeedGroupEntity) : this(feedGroupEntity.uid, feedGroupEntity.name, feedGroupEntity.icon)
|
constructor (feedGroupEntity: FeedGroupEntity) : this(feedGroupEntity.uid, feedGroupEntity.name, feedGroupEntity.icon)
|
||||||
|
|
||||||
override fun getId(): Long {
|
override fun getId(): Long {
|
||||||
|
@ -24,8 +23,10 @@ data class FeedGroupCardItem(
|
||||||
|
|
||||||
override fun getLayout(): Int = R.layout.feed_group_card_item
|
override fun getLayout(): Int = R.layout.feed_group_card_item
|
||||||
|
|
||||||
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
override fun bind(viewBinding: FeedGroupCardItemBinding, position: Int) {
|
||||||
viewHolder.title.text = name
|
viewBinding.title.text = name
|
||||||
viewHolder.icon.setImageResource(icon.getDrawableRes(viewHolder.containerView.context))
|
viewBinding.icon.setImageResource(icon.getDrawableRes(viewBinding.root.context))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun initializeViewBinding(view: View) = FeedGroupCardItemBinding.bind(view)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue