mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-25 16:36:57 +00:00
Update Groupie list library to v2.7.0
This commit is contained in:
parent
a93e2cdc30
commit
8b87893248
@ -116,8 +116,8 @@ dependencies {
|
|||||||
implementation "androidx.cardview:cardview:${androidxLibVersion}"
|
implementation "androidx.cardview:cardview:${androidxLibVersion}"
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
|
||||||
implementation 'com.xwray:groupie:2.3.0'
|
implementation 'com.xwray:groupie:2.7.0'
|
||||||
implementation 'com.xwray:groupie-kotlin-android-extensions:2.3.0'
|
implementation 'com.xwray:groupie-kotlin-android-extensions:2.7.0'
|
||||||
|
|
||||||
implementation 'androidx.lifecycle:lifecycle-livedata:2.0.0'
|
implementation 'androidx.lifecycle:lifecycle-livedata:2.0.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
|
||||||
|
@ -16,7 +16,7 @@ import com.xwray.groupie.Group
|
|||||||
import com.xwray.groupie.GroupAdapter
|
import com.xwray.groupie.GroupAdapter
|
||||||
import com.xwray.groupie.Item
|
import com.xwray.groupie.Item
|
||||||
import com.xwray.groupie.Section
|
import com.xwray.groupie.Section
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import icepick.State
|
import icepick.State
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import kotlinx.android.synthetic.main.dialog_title.view.*
|
import kotlinx.android.synthetic.main.dialog_title.view.*
|
||||||
@ -49,7 +49,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
|||||||
|
|
||||||
private var subscriptionBroadcastReceiver: BroadcastReceiver? = null
|
private var subscriptionBroadcastReceiver: BroadcastReceiver? = null
|
||||||
|
|
||||||
private val groupAdapter = GroupAdapter<ViewHolder>()
|
private val groupAdapter = GroupAdapter<GroupieViewHolder>()
|
||||||
private val feedGroupsSection = Section()
|
private val feedGroupsSection = Section()
|
||||||
private var feedGroupsCarousel: FeedGroupCarouselItem? = null
|
private var feedGroupsCarousel: FeedGroupCarouselItem? = null
|
||||||
private lateinit var importExportItem: FeedImportExportItem
|
private lateinit var importExportItem: FeedImportExportItem
|
||||||
@ -189,7 +189,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
|||||||
|
|
||||||
private fun setupInitialLayout() {
|
private fun setupInitialLayout() {
|
||||||
Section().apply {
|
Section().apply {
|
||||||
val carouselAdapter = GroupAdapter<ViewHolder>()
|
val carouselAdapter = GroupAdapter<GroupieViewHolder>()
|
||||||
|
|
||||||
carouselAdapter.add(FeedGroupCardItem(-1, getString(R.string.all), FeedGroupIcon.ALL))
|
carouselAdapter.add(FeedGroupCardItem(-1, getString(R.string.all), FeedGroupIcon.ALL))
|
||||||
carouselAdapter.add(feedGroupsSection)
|
carouselAdapter.add(feedGroupsSection)
|
||||||
|
@ -19,7 +19,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.xwray.groupie.GroupAdapter
|
import com.xwray.groupie.GroupAdapter
|
||||||
import com.xwray.groupie.Section
|
import com.xwray.groupie.Section
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import icepick.Icepick
|
import icepick.Icepick
|
||||||
import icepick.State
|
import icepick.State
|
||||||
import kotlinx.android.synthetic.main.dialog_feed_group_create.*
|
import kotlinx.android.synthetic.main.dialog_feed_group_create.*
|
||||||
@ -180,7 +180,7 @@ class FeedGroupDialog : DialogFragment() {
|
|||||||
this.selectedSubscriptions.addAll(selectedSubscriptions)
|
this.selectedSubscriptions.addAll(selectedSubscriptions)
|
||||||
val useGridLayout = subscriptions.isNotEmpty()
|
val useGridLayout = subscriptions.isNotEmpty()
|
||||||
|
|
||||||
val groupAdapter = GroupAdapter<ViewHolder>()
|
val groupAdapter = GroupAdapter<GroupieViewHolder>()
|
||||||
groupAdapter.spanCount = if (useGridLayout) 4 else 1
|
groupAdapter.spanCount = if (useGridLayout) 4 else 1
|
||||||
|
|
||||||
val selectedCountText = getString(R.string.feed_group_dialog_selection_count, this.selectedSubscriptions.size)
|
val selectedCountText = getString(R.string.feed_group_dialog_selection_count, this.selectedSubscriptions.size)
|
||||||
@ -250,7 +250,7 @@ class FeedGroupDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupIconPicker() {
|
private fun setupIconPicker() {
|
||||||
val groupAdapter = GroupAdapter<ViewHolder>()
|
val groupAdapter = GroupAdapter<GroupieViewHolder>()
|
||||||
groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(requireContext(), it) })
|
groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(requireContext(), it) })
|
||||||
|
|
||||||
icon_selector.apply {
|
icon_selector.apply {
|
||||||
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.local.subscription.item
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.nostra13.universalimageloader.core.ImageLoader
|
import com.nostra13.universalimageloader.core.ImageLoader
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.list_channel_item.*
|
import kotlinx.android.synthetic.main.list_channel_item.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem
|
import org.schabi.newpipe.extractor.channel.ChannelInfoItem
|
||||||
@ -29,7 +29,7 @@ class ChannelItem(
|
|||||||
ItemVersion.GRID -> R.layout.list_channel_grid_item
|
ItemVersion.GRID -> R.layout.list_channel_grid_item
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
viewHolder.itemTitleView.text = infoItem.name
|
viewHolder.itemTitleView.text = infoItem.name
|
||||||
viewHolder.itemAdditionalDetails.text = getDetailLine(viewHolder.root.context)
|
viewHolder.itemAdditionalDetails.text = getDetailLine(viewHolder.root.context)
|
||||||
if (itemVersion == ItemVersion.NORMAL) viewHolder.itemChannelDescriptionView.text = infoItem.description
|
if (itemVersion == ItemVersion.NORMAL) viewHolder.itemChannelDescriptionView.text = infoItem.description
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.schabi.newpipe.local.subscription.item
|
package org.schabi.newpipe.local.subscription.item
|
||||||
|
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
|
|
||||||
class EmptyPlaceholderItem : Item() {
|
class EmptyPlaceholderItem : Item() {
|
||||||
override fun getLayout(): Int = R.layout.list_empty_view
|
override fun getLayout(): Int = R.layout.list_empty_view
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {}
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {}
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package org.schabi.newpipe.local.subscription.item
|
package org.schabi.newpipe.local.subscription.item
|
||||||
|
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
|
|
||||||
class FeedGroupAddItem : Item() {
|
class FeedGroupAddItem : Item() {
|
||||||
override fun getLayout(): Int = R.layout.feed_group_add_new_item
|
override fun getLayout(): Int = R.layout.feed_group_add_new_item
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {}
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package org.schabi.newpipe.local.subscription.item
|
package org.schabi.newpipe.local.subscription.item
|
||||||
|
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.feed_group_card_item.*
|
import kotlinx.android.synthetic.main.feed_group_card_item.*
|
||||||
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
|
||||||
@ -20,7 +20,7 @@ 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: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
viewHolder.title.text = name
|
viewHolder.title.text = name
|
||||||
viewHolder.icon.setImageResource(icon.getDrawableRes(viewHolder.containerView.context))
|
viewHolder.icon.setImageResource(icon.getDrawableRes(viewHolder.containerView.context))
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.xwray.groupie.GroupAdapter
|
import com.xwray.groupie.GroupAdapter
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.feed_item_carousel.*
|
import kotlinx.android.synthetic.main.feed_item_carousel.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.local.subscription.decoration.FeedGroupCarouselDecoration
|
import org.schabi.newpipe.local.subscription.decoration.FeedGroupCarouselDecoration
|
||||||
|
|
||||||
class FeedGroupCarouselItem(context: Context, private val carouselAdapter: GroupAdapter<ViewHolder>) : Item() {
|
class FeedGroupCarouselItem(context: Context, private val carouselAdapter: GroupAdapter<GroupieViewHolder>) : Item() {
|
||||||
private val feedGroupCarouselDecoration = FeedGroupCarouselDecoration(context)
|
private val feedGroupCarouselDecoration = FeedGroupCarouselDecoration(context)
|
||||||
|
|
||||||
private var linearLayoutManager: LinearLayoutManager? = null
|
private var linearLayoutManager: LinearLayoutManager? = null
|
||||||
@ -30,7 +30,7 @@ class FeedGroupCarouselItem(context: Context, private val carouselAdapter: Group
|
|||||||
listState = state
|
listState = state
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createViewHolder(itemView: View): ViewHolder {
|
override fun createViewHolder(itemView: View): GroupieViewHolder {
|
||||||
val viewHolder = super.createViewHolder(itemView)
|
val viewHolder = super.createViewHolder(itemView)
|
||||||
|
|
||||||
linearLayoutManager = LinearLayoutManager(itemView.context, RecyclerView.HORIZONTAL, false)
|
linearLayoutManager = LinearLayoutManager(itemView.context, RecyclerView.HORIZONTAL, false)
|
||||||
@ -44,12 +44,12 @@ class FeedGroupCarouselItem(context: Context, private val carouselAdapter: Group
|
|||||||
return viewHolder
|
return viewHolder
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
viewHolder.recycler_view.apply { adapter = carouselAdapter }
|
viewHolder.recycler_view.apply { adapter = carouselAdapter }
|
||||||
linearLayoutManager?.onRestoreInstanceState(listState)
|
linearLayoutManager?.onRestoreInstanceState(listState)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun unbind(viewHolder: ViewHolder) {
|
override fun unbind(viewHolder: GroupieViewHolder) {
|
||||||
super.unbind(viewHolder)
|
super.unbind(viewHolder)
|
||||||
|
|
||||||
listState = linearLayoutManager?.onSaveInstanceState()
|
listState = linearLayoutManager?.onSaveInstanceState()
|
||||||
|
@ -7,8 +7,8 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
|
||||||
import kotlinx.android.synthetic.main.feed_import_export_group.*
|
import kotlinx.android.synthetic.main.feed_import_export_group.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.extractor.NewPipe
|
import org.schabi.newpipe.extractor.NewPipe
|
||||||
@ -28,7 +28,7 @@ class FeedImportExportItem(
|
|||||||
const val REFRESH_EXPANDED_STATUS = 123
|
const val REFRESH_EXPANDED_STATUS = 123
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int, payloads: MutableList<Any>) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int, payloads: MutableList<Any>) {
|
||||||
if (payloads.contains(REFRESH_EXPANDED_STATUS)) {
|
if (payloads.contains(REFRESH_EXPANDED_STATUS)) {
|
||||||
viewHolder.import_export_options.apply { if (isExpanded) expand() else collapse() }
|
viewHolder.import_export_options.apply { if (isExpanded) expand() else collapse() }
|
||||||
return
|
return
|
||||||
@ -39,7 +39,7 @@ class FeedImportExportItem(
|
|||||||
|
|
||||||
override fun getLayout(): Int = R.layout.feed_import_export_group
|
override fun getLayout(): Int = R.layout.feed_import_export_group
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
if (viewHolder.import_from_options.childCount == 0) setupImportFromItems(viewHolder.import_from_options)
|
if (viewHolder.import_from_options.childCount == 0) setupImportFromItems(viewHolder.import_from_options)
|
||||||
if (viewHolder.export_to_options.childCount == 0) setupExportToItems(viewHolder.export_to_options)
|
if (viewHolder.export_to_options.childCount == 0) setupExportToItems(viewHolder.export_to_options)
|
||||||
|
|
||||||
@ -60,9 +60,9 @@ class FeedImportExportItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun unbind(holder: ViewHolder) {
|
override fun unbind(viewHolder: GroupieViewHolder) {
|
||||||
super.unbind(holder)
|
super.unbind(viewHolder)
|
||||||
expandIconListener?.let { holder.import_export_options.removeListener(it) }
|
expandIconListener?.let { viewHolder.import_export_options.removeListener(it) }
|
||||||
expandIconListener = null
|
expandIconListener = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package org.schabi.newpipe.local.subscription.item
|
|||||||
|
|
||||||
import android.view.View.OnClickListener
|
import android.view.View.OnClickListener
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.header_item.*
|
import kotlinx.android.synthetic.main.header_item.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ class HeaderItem(val title: String, private val onClickListener: (() -> Unit)? =
|
|||||||
|
|
||||||
override fun getLayout(): Int = R.layout.header_item
|
override fun getLayout(): Int = R.layout.header_item
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
viewHolder.header_title.text = title
|
viewHolder.header_title.text = title
|
||||||
|
|
||||||
val listener: OnClickListener? = if (onClickListener != null) OnClickListener { onClickListener.invoke() } else null
|
val listener: OnClickListener? = if (onClickListener != null) OnClickListener { onClickListener.invoke() } else null
|
||||||
|
@ -2,7 +2,7 @@ package org.schabi.newpipe.local.subscription.item
|
|||||||
|
|
||||||
import android.view.View.OnClickListener
|
import android.view.View.OnClickListener
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.header_with_text_item.*
|
import kotlinx.android.synthetic.main.header_with_text_item.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ class HeaderTextSideItem(
|
|||||||
|
|
||||||
override fun getLayout(): Int = R.layout.header_with_text_item
|
override fun getLayout(): Int = R.layout.header_with_text_item
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int, payloads: MutableList<Any>) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int, payloads: MutableList<Any>) {
|
||||||
if (payloads.contains(UPDATE_INFO)) {
|
if (payloads.contains(UPDATE_INFO)) {
|
||||||
viewHolder.header_info.text = infoText
|
viewHolder.header_info.text = infoText
|
||||||
return
|
return
|
||||||
@ -27,7 +27,7 @@ class HeaderTextSideItem(
|
|||||||
super.bind(viewHolder, position, payloads)
|
super.bind(viewHolder, position, payloads)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
viewHolder.header_title.text = title
|
viewHolder.header_title.text = title
|
||||||
viewHolder.header_info.text = infoText
|
viewHolder.header_info.text = infoText
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.local.subscription.item
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.picker_icon_item.*
|
import kotlinx.android.synthetic.main.picker_icon_item.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.local.subscription.FeedGroupIcon
|
import org.schabi.newpipe.local.subscription.FeedGroupIcon
|
||||||
@ -13,7 +13,7 @@ class PickerIconItem(context: Context, val icon: FeedGroupIcon) : Item() {
|
|||||||
|
|
||||||
override fun getLayout(): Int = R.layout.picker_icon_item
|
override fun getLayout(): Int = R.layout.picker_icon_item
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
viewHolder.icon_view.setImageResource(iconRes)
|
viewHolder.icon_view.setImageResource(iconRes)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ import android.view.View
|
|||||||
import com.nostra13.universalimageloader.core.DisplayImageOptions
|
import com.nostra13.universalimageloader.core.DisplayImageOptions
|
||||||
import com.nostra13.universalimageloader.core.ImageLoader
|
import com.nostra13.universalimageloader.core.ImageLoader
|
||||||
import com.xwray.groupie.kotlinandroidextensions.Item
|
import com.xwray.groupie.kotlinandroidextensions.Item
|
||||||
import com.xwray.groupie.kotlinandroidextensions.ViewHolder
|
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
|
||||||
import kotlinx.android.synthetic.main.picker_subscription_item.*
|
import kotlinx.android.synthetic.main.picker_subscription_item.*
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.database.subscription.SubscriptionEntity
|
import org.schabi.newpipe.database.subscription.SubscriptionEntity
|
||||||
@ -21,7 +21,7 @@ data class PickerSubscriptionItem(val subscriptionEntity: SubscriptionEntity, va
|
|||||||
|
|
||||||
override fun getLayout(): Int = R.layout.picker_subscription_item
|
override fun getLayout(): Int = R.layout.picker_subscription_item
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int, payloads: MutableList<Any>) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int, payloads: MutableList<Any>) {
|
||||||
if (payloads.contains(UPDATE_SELECTED)) {
|
if (payloads.contains(UPDATE_SELECTED)) {
|
||||||
animateView(viewHolder.selected_highlight, AnimationUtils.Type.LIGHT_SCALE_AND_ALPHA, isSelected, 150)
|
animateView(viewHolder.selected_highlight, AnimationUtils.Type.LIGHT_SCALE_AND_ALPHA, isSelected, 150)
|
||||||
return
|
return
|
||||||
@ -30,14 +30,14 @@ data class PickerSubscriptionItem(val subscriptionEntity: SubscriptionEntity, va
|
|||||||
super.bind(viewHolder, position, payloads)
|
super.bind(viewHolder, position, payloads)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bind(viewHolder: ViewHolder, position: Int) {
|
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
|
||||||
ImageLoader.getInstance().displayImage(subscriptionEntity.avatarUrl, viewHolder.thumbnail_view, IMAGE_LOADING_OPTIONS)
|
ImageLoader.getInstance().displayImage(subscriptionEntity.avatarUrl, viewHolder.thumbnail_view, IMAGE_LOADING_OPTIONS)
|
||||||
|
|
||||||
viewHolder.title_view.text = subscriptionEntity.name
|
viewHolder.title_view.text = subscriptionEntity.name
|
||||||
viewHolder.selected_highlight.visibility = if (isSelected) View.VISIBLE else View.GONE
|
viewHolder.selected_highlight.visibility = if (isSelected) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun unbind(viewHolder: ViewHolder) {
|
override fun unbind(viewHolder: GroupieViewHolder) {
|
||||||
super.unbind(viewHolder)
|
super.unbind(viewHolder)
|
||||||
|
|
||||||
viewHolder.selected_highlight.animate().setListener(null).cancel()
|
viewHolder.selected_highlight.animate().setListener(null).cancel()
|
||||||
|
Loading…
Reference in New Issue
Block a user