always redraw icons after fetching just to avoid some glitches

This commit is contained in:
tibbi 2022-09-18 20:21:30 +02:00
parent 13b3e11c5c
commit cc38bb4af4
2 changed files with 4 additions and 6 deletions

View File

@ -70,7 +70,7 @@ class MainActivity : SimpleActivity(), FlingListener {
ensureBackgroundThread {
getDefaultAppPackages()
config.wasHomeScreenInit = true
home_screen_grid.fetchAppIcons(true)
home_screen_grid.fetchAppIcons()
}
}
}

View File

@ -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<HomeScreenGridItem>
appIcons.forEach { item ->
@ -51,11 +51,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
}
}
if (forceRedraw) {
invalidate()
}
}
}
@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas) {