Remove unneeded code

This commit is contained in:
gregf36665 2024-12-22 20:08:53 +00:00 committed by Syndromeramo
parent 932f1770ff
commit cbe3a04b5a

View file

@ -95,7 +95,6 @@ class ShelfListener : InteractionListener {
return
}
val itemsPerPage = 4
val totalPages = (shelfItemsNames.size + itemsPerPage - 1) / itemsPerPage // Total number of pages
when (stage) {
0, shelfItemsNames.size + 1 -> { // Initial stage or final more button clicked
@ -106,14 +105,9 @@ class ShelfListener : InteractionListener {
val currentPage = stage / (itemsPerPage + 1)
val startIndex = currentPage * itemsPerPage
if (buttonID == itemsPerPage + 1) { // "More" button clicked
if (currentPage < totalPages) {
val topics = createTopics(currentPage + 1, itemsPerPage)
showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 }
} else { // Last page, loop back to the first page
val topics = createTopics(1, itemsPerPage)
showTopics(*topics.toTypedArray()).also { stage = 1 }
}
if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one)
val topics = createTopics(currentPage + 1, itemsPerPage)
showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 }
} else { // Handle item selection
val itemIndex = startIndex + (buttonID - 1)
if (itemIndex < shelfItemsNames.size) {