From 2f6cb87bba9afa2cd110a2c703600afb6a11c858 Mon Sep 17 00:00:00 2001 From: Stypox Date: Thu, 27 Oct 2022 23:32:19 +0200 Subject: [PATCH 1/2] Use GROUP_ALL_ID instead of hardcoded -1 --- .../local/subscription/SubscriptionFragment.kt | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index ca0a7b8d4..b2337eeca 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -27,7 +27,7 @@ import com.xwray.groupie.viewbinding.GroupieViewHolder import icepick.State import io.reactivex.rxjava3.disposables.CompositeDisposable 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.FeedItemCarouselBinding import org.schabi.newpipe.databinding.FragmentSubscriptionBinding @@ -276,14 +276,8 @@ class SubscriptionFragment : BaseStateFragment() { } } carouselAdapter.setOnItemLongClickListener { item, _ -> - if (( - item is FeedGroupCardItem && - item.groupId == FeedGroupEntity.GROUP_ALL_ID - ) || - ( - item is FeedGroupCardGridItem && - item.groupId == FeedGroupEntity.GROUP_ALL_ID - ) + if ((item is FeedGroupCardItem && item.groupId == GROUP_ALL_ID) || + (item is FeedGroupCardGridItem && item.groupId == GROUP_ALL_ID) ) { return@setOnItemLongClickListener false } @@ -437,10 +431,10 @@ class SubscriptionFragment : BaseStateFragment() { clear() if (listViewMode) { add(FeedGroupAddNewItem()) - add(FeedGroupCardItem(-1, getString(R.string.all), FeedGroupIcon.RSS)) + add(FeedGroupCardItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS)) } else { add(FeedGroupAddNewGridItem()) - add(FeedGroupCardGridItem(-1, getString(R.string.all), FeedGroupIcon.RSS)) + add(FeedGroupCardGridItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS)) } addAll(groups) } From 57d2fe113a5a41c2325f4809c01ae33e3fd69c79 Mon Sep 17 00:00:00 2001 From: Stypox Date: Thu, 27 Oct 2022 23:43:27 +0200 Subject: [PATCH 2/2] Fix duplicate videos in feed "All" --- .../java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt b/app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt index b2b3d18a6..968d0c88f 100644 --- a/app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt +++ b/app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt @@ -48,7 +48,10 @@ abstract class FeedDAO { ON s.uid = f.stream_id LEFT JOIN feed_group_subscription_join fgs - ON fgs.subscription_id = f.subscription_id + ON ( + :groupId <> ${FeedGroupEntity.GROUP_ALL_ID} + AND fgs.subscription_id = f.subscription_id + ) WHERE ( :groupId = ${FeedGroupEntity.GROUP_ALL_ID}