From 8603f3b1978f18aaa82a5a5856ecaffe414be559 Mon Sep 17 00:00:00 2001 From: Josiah Campbell <9521010+jocmp@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:30:29 -0600 Subject: [PATCH] Fix next filter bug on folder overscroll --- .../java/com/jocmp/capy/articles/NextFilter.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/capy/src/main/java/com/jocmp/capy/articles/NextFilter.kt b/capy/src/main/java/com/jocmp/capy/articles/NextFilter.kt index 789c4859..35fae475 100644 --- a/capy/src/main/java/com/jocmp/capy/articles/NextFilter.kt +++ b/capy/src/main/java/com/jocmp/capy/articles/NextFilter.kt @@ -56,12 +56,20 @@ sealed class NextFilter { } is ArticleFilter.Folders -> { - val firstFeed = folders + val firstFolderFeed = folders .find { it.title == filter.folderTitle } ?.feeds - ?.firstOrNull() ?: return null + ?.firstOrNull() - FeedFilter(feedID = firstFeed.id, folderTitle = filter.folderTitle) + val nextFeed = feeds.firstOrNull() + + if (firstFolderFeed != null) { + FeedFilter(feedID = firstFolderFeed.id, folderTitle = filter.folderTitle) + } else if (nextFeed != null) { + FeedFilter(feedID = nextFeed.id, folderTitle = null) + } else { + null + } } is ArticleFilter.Feeds -> findNextFeed(filter, folders, feeds)