Fix Previous episode button showing on the first episode

adjacentTo returns [current, next] on the first episode, and the old code took the first sibling that was not the current item, so it picked the next episode as the previous one. Only count an item that sits before the current one.
This commit is contained in:
Cory Carter authored and Niels van Velzen committed 2026-10-13 16:25:02 +02:00
1 parent b6fa1bf1ac
commit 7fb9d9de3e
1 file changed
+2 -4
@@ -217,10 +217,8 @@ fun FullDetailsFragment.populatePreviousButton() {
).content
}
val previousItem = siblings.items
.filterNot { it.id == mBaseItem.id }
.firstOrNull()
?.id
val currentIndex = siblings.items.indexOfFirst { it.id == mBaseItem.id }
val previousItem = siblings.items.getOrNull(currentIndex - 1)?.id
mPrevItemId = previousItem
mPrevButton.isVisible = previousItem != null