From 285a8f1c5a896b9e0874bb2c938519e9007e8746 Mon Sep 17 00:00:00 2001 From: Shivam Kadam <111723283+AndroidJunior9@users.noreply.github.com> Date: Wed, 3 Jan 2024 12:25:18 +0530 Subject: [PATCH] Fixed InCorrect Month Progression Bug (#159) --- .../kalendar/endlos/paging/KalendarPagingSource.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kalendar-endlos/src/main/java/com/himanshoe/kalendar/endlos/paging/KalendarPagingSource.kt b/kalendar-endlos/src/main/java/com/himanshoe/kalendar/endlos/paging/KalendarPagingSource.kt index fa720b46..dbfd972f 100644 --- a/kalendar-endlos/src/main/java/com/himanshoe/kalendar/endlos/paging/KalendarPagingSource.kt +++ b/kalendar-endlos/src/main/java/com/himanshoe/kalendar/endlos/paging/KalendarPagingSource.kt @@ -45,10 +45,14 @@ class KalendarPagingSource( val page = params.key ?: today.year // Filter out the months before the current month and year - val kalendarItems = kalendarRepository.generateDates(page) - .filter { date -> - date.year >= today.year && date.month.value >= today.monthNumber + val kalendarItems = kalendarRepository.generateDates(page).filter { date -> + if (date.year == today.year) { + date.month.value >= today.monthNumber + } else { + date.year > today.year } + } + val nextPage = page.plus(1)