1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

Use GROUP_ALL_ID instead of hardcoded -1

This commit is contained in:
Stypox 2022-10-27 23:32:19 +02:00
parent 3cef7f3201
commit 2f6cb87bba
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -27,7 +27,7 @@ import com.xwray.groupie.viewbinding.GroupieViewHolder
import icepick.State import icepick.State
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
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.Companion.GROUP_ALL_ID
import org.schabi.newpipe.databinding.DialogTitleBinding import org.schabi.newpipe.databinding.DialogTitleBinding
import org.schabi.newpipe.databinding.FeedItemCarouselBinding import org.schabi.newpipe.databinding.FeedItemCarouselBinding
import org.schabi.newpipe.databinding.FragmentSubscriptionBinding import org.schabi.newpipe.databinding.FragmentSubscriptionBinding
@ -276,14 +276,8 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
} }
} }
carouselAdapter.setOnItemLongClickListener { item, _ -> carouselAdapter.setOnItemLongClickListener { item, _ ->
if (( if ((item is FeedGroupCardItem && item.groupId == GROUP_ALL_ID) ||
item is FeedGroupCardItem && (item is FeedGroupCardGridItem && item.groupId == GROUP_ALL_ID)
item.groupId == FeedGroupEntity.GROUP_ALL_ID
) ||
(
item is FeedGroupCardGridItem &&
item.groupId == FeedGroupEntity.GROUP_ALL_ID
)
) { ) {
return@setOnItemLongClickListener false return@setOnItemLongClickListener false
} }
@ -437,10 +431,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
clear() clear()
if (listViewMode) { if (listViewMode) {
add(FeedGroupAddNewItem()) add(FeedGroupAddNewItem())
add(FeedGroupCardItem(-1, getString(R.string.all), FeedGroupIcon.RSS)) add(FeedGroupCardItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS))
} else { } else {
add(FeedGroupAddNewGridItem()) add(FeedGroupAddNewGridItem())
add(FeedGroupCardGridItem(-1, getString(R.string.all), FeedGroupIcon.RSS)) add(FeedGroupCardGridItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS))
} }
addAll(groups) addAll(groups)
} }