Skip to content

Commit bf61acc

Browse files
committed
adding some crashfixes
1 parent 0ba3d75 commit bf61acc

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
<activity
5656
android:name=".activities.SettingsActivity"
57+
android:configChanges="orientation"
5758
android:exported="true"
5859
android:label="@string/settings"
5960
android:parentActivityName=".activities.MainActivity">

app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
511511

512512
@SuppressLint("DrawAllocation")
513513
override fun onDraw(canvas: Canvas?) {
514-
super.onDraw(canvas)
515514
if (canvas == null) {
516515
return
517516
}
518517

518+
super.onDraw(canvas)
519519
if (cellXCoords.isEmpty()) {
520520
fillCellSizes()
521521
}

0 commit comments

Comments
 (0)