@@ -131,8 +131,12 @@ class MainActivity : SimpleActivity(), FlingListener {
131131
132132 // delay showing the shortcut both to let the user see adding it in realtime and hackily avoid concurrent modification exception at HomeScreenGrid
133133 Thread .sleep(2000 )
134- item.accept()
135- home_screen_grid.storeAndShowGridItem(gridItem)
134+
135+ try {
136+ item.accept()
137+ home_screen_grid.storeAndShowGridItem(gridItem)
138+ } catch (ignored: IllegalStateException ) {
139+ }
136140 }
137141 }
138142 }
@@ -171,7 +175,7 @@ class MainActivity : SimpleActivity(), FlingListener {
171175
172176 main_holder.onGlobalLayout {
173177 if (isPiePlus()) {
174- val addTopPadding = main_holder.rootWindowInsets.displayCutout != null
178+ val addTopPadding = main_holder.rootWindowInsets? .displayCutout != null
175179 (all_apps_fragment as AllAppsFragment ).setupViews(addTopPadding)
176180 (widgets_fragment as WidgetsFragment ).setupViews(addTopPadding)
177181 }
@@ -248,8 +252,8 @@ class MainActivity : SimpleActivity(), FlingListener {
248252
249253 override fun onConfigurationChanged (newConfig : Configuration ) {
250254 super .onConfigurationChanged(newConfig)
251- (all_apps_fragment as AllAppsFragment ).onConfigurationChanged()
252- (widgets_fragment as WidgetsFragment ).onConfigurationChanged()
255+ (all_apps_fragment as ? AllAppsFragment )? .onConfigurationChanged()
256+ (widgets_fragment as ? WidgetsFragment )? .onConfigurationChanged()
253257 }
254258
255259 override fun onTouchEvent (event : MotionEvent ? ): Boolean {
@@ -651,7 +655,10 @@ class MainActivity : SimpleActivity(), FlingListener {
651655
652656 @SuppressLint(" WrongConstant" )
653657 fun getAllAppLaunchers (): ArrayList <AppLauncher > {
654- val hiddenIcons = hiddenIconsDB.getHiddenIcons().map { it.getIconIdentifier() }
658+ val hiddenIcons = hiddenIconsDB.getHiddenIcons().map {
659+ it.getIconIdentifier()
660+ }
661+
655662 val allApps = ArrayList <AppLauncher >()
656663 val intent = Intent (Intent .ACTION_MAIN , null )
657664 intent.addCategory(Intent .CATEGORY_LAUNCHER )
0 commit comments