refresh the home screen once initial apps have been stored

This commit is contained in:
tibbi 2022-09-18 19:19:00 +02:00
parent e9c248b520
commit 13b3e11c5c
2 changed files with 9 additions and 0 deletions

View file

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

View file

@ -38,6 +38,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
textSize = context.resources.getDimension(R.dimen.normal_text_size)
}
fetchAppIcons(false)
}
fun fetchAppIcons(forceRedraw: Boolean) {
ensureBackgroundThread {
appIcons = context.homeScreenGridItemsDB.getAllItems() as ArrayList<HomeScreenGridItem>
appIcons.forEach { item ->
@ -46,6 +50,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
appIconDrawables[item.packageName] = drawable
}
}
if (forceRedraw) {
invalidate()
}
}
}