From 35fe1da420d05cd76030b53c4bb8e0fb2f698734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 20 Jul 2023 12:09:28 +0200 Subject: [PATCH] Navigate to previous page if current one is empty --- .../simplemobiletools/launcher/views/HomeScreenGrid.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt index d0e061c..f7ffda3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt @@ -169,6 +169,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel } gridItems.removeIf { it.id == item.id } + if (currentPage > getMaxPage()) { + post { + prevPage() + } + } redrawGrid() } } @@ -529,6 +534,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel } else { removeItemFromHomeScreen(item) } + + if (currentPage > getMaxPage()) { + prevPage(redraw = true) + } } } }