Skip to content

Commit 2f6cb87

Browse files
committed
Use GROUP_ALL_ID instead of hardcoded -1
1 parent 3cef7f3 commit 2f6cb87

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import com.xwray.groupie.viewbinding.GroupieViewHolder
2727
import icepick.State
2828
import io.reactivex.rxjava3.disposables.CompositeDisposable
2929
import org.schabi.newpipe.R
30-
import org.schabi.newpipe.database.feed.model.FeedGroupEntity
30+
import org.schabi.newpipe.database.feed.model.FeedGroupEntity.Companion.GROUP_ALL_ID
3131
import org.schabi.newpipe.databinding.DialogTitleBinding
3232
import org.schabi.newpipe.databinding.FeedItemCarouselBinding
3333
import org.schabi.newpipe.databinding.FragmentSubscriptionBinding
@@ -276,14 +276,8 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
276276
}
277277
}
278278
carouselAdapter.setOnItemLongClickListener { item, _ ->
279-
if ((
280-
item is FeedGroupCardItem &&
281-
item.groupId == FeedGroupEntity.GROUP_ALL_ID
282-
) ||
283-
(
284-
item is FeedGroupCardGridItem &&
285-
item.groupId == FeedGroupEntity.GROUP_ALL_ID
286-
)
279+
if ((item is FeedGroupCardItem && item.groupId == GROUP_ALL_ID) ||
280+
(item is FeedGroupCardGridItem && item.groupId == GROUP_ALL_ID)
287281
) {
288282
return@setOnItemLongClickListener false
289283
}
@@ -437,10 +431,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
437431
clear()
438432
if (listViewMode) {
439433
add(FeedGroupAddNewItem())
440-
add(FeedGroupCardItem(-1, getString(R.string.all), FeedGroupIcon.RSS))
434+
add(FeedGroupCardItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS))
441435
} else {
442436
add(FeedGroupAddNewGridItem())
443-
add(FeedGroupCardGridItem(-1, getString(R.string.all), FeedGroupIcon.RSS))
437+
add(FeedGroupCardGridItem(GROUP_ALL_ID, getString(R.string.all), FeedGroupIcon.RSS))
444438
}
445439
addAll(groups)
446440
}

0 commit comments

Comments
 (0)