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