From cc38bb4af4287651b24775e92c9a2c85570ce3f7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Sep 2022 20:21:30 +0200 Subject: [PATCH] always redraw icons after fetching just to avoid some glitches --- .../simplemobiletools/launcher/activities/MainActivity.kt | 2 +- .../simplemobiletools/launcher/views/HomeScreenGrid.kt | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt index ff24800..f663078 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -70,7 +70,7 @@ class MainActivity : SimpleActivity(), FlingListener { ensureBackgroundThread { getDefaultAppPackages() config.wasHomeScreenInit = true - home_screen_grid.fetchAppIcons(true) + home_screen_grid.fetchAppIcons() } } } 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 83a7181..37ca261 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt @@ -38,10 +38,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie textSize = context.resources.getDimension(R.dimen.normal_text_size) } - fetchAppIcons(false) + fetchAppIcons() } - fun fetchAppIcons(forceRedraw: Boolean) { + fun fetchAppIcons() { ensureBackgroundThread { appIcons = context.homeScreenGridItemsDB.getAllItems() as ArrayList appIcons.forEach { item -> @@ -51,9 +51,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie } } - if (forceRedraw) { - invalidate() - } + invalidate() } }