From e5696173f459a09b3666a89a9e3fc0efd2018732 Mon Sep 17 00:00:00 2001 From: Sad Ellie Date: Mon, 12 Feb 2024 22:12:40 +0300 Subject: [PATCH] Rotate PagedIsland --- .../java/com/sadellie/unitto/core/ui/common/PagedIsland.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/ui/src/main/java/com/sadellie/unitto/core/ui/common/PagedIsland.kt b/core/ui/src/main/java/com/sadellie/unitto/core/ui/common/PagedIsland.kt index 210253f4..9b076f68 100644 --- a/core/ui/src/main/java/com/sadellie/unitto/core/ui/common/PagedIsland.kt +++ b/core/ui/src/main/java/com/sadellie/unitto/core/ui/common/PagedIsland.kt @@ -74,10 +74,13 @@ fun PagedIsland( .clip(RoundedCornerShape(32.dp)) .clickable { onClick() - if (pagerState.currentPage == (pagerState.pageCount - 1)) return@clickable + val targetPage = pagerState.currentPage + 1 corScope.launch { - pagerState.animateScrollToPage(pagerState.currentPage + 1) + pagerState.animateScrollToPage( + // Animate to first page if target page is out of bounds + if (targetPage >= pagerState.pageCount) 0 else targetPage + ) } } .background(backgroundColor)