adding some crashfixes

This commit is contained in:
tibbi
2023-02-12 23:31:33 +01:00
parent 0ba3d75776
commit bf61acc715
3 changed files with 15 additions and 7 deletions

View File

@@ -54,6 +54,7 @@
<activity <activity
android:name=".activities.SettingsActivity" android:name=".activities.SettingsActivity"
android:configChanges="orientation"
android:exported="true" android:exported="true"
android:label="@string/settings" android:label="@string/settings"
android:parentActivityName=".activities.MainActivity"> android:parentActivityName=".activities.MainActivity">

View File

@@ -131,8 +131,12 @@ class MainActivity : SimpleActivity(), FlingListener {
// delay showing the shortcut both to let the user see adding it in realtime and hackily avoid concurrent modification exception at HomeScreenGrid // delay showing the shortcut both to let the user see adding it in realtime and hackily avoid concurrent modification exception at HomeScreenGrid
Thread.sleep(2000) Thread.sleep(2000)
item.accept()
home_screen_grid.storeAndShowGridItem(gridItem) try {
item.accept()
home_screen_grid.storeAndShowGridItem(gridItem)
} catch (ignored: IllegalStateException) {
}
} }
} }
} }
@@ -171,7 +175,7 @@ class MainActivity : SimpleActivity(), FlingListener {
main_holder.onGlobalLayout { main_holder.onGlobalLayout {
if (isPiePlus()) { if (isPiePlus()) {
val addTopPadding = main_holder.rootWindowInsets.displayCutout != null val addTopPadding = main_holder.rootWindowInsets?.displayCutout != null
(all_apps_fragment as AllAppsFragment).setupViews(addTopPadding) (all_apps_fragment as AllAppsFragment).setupViews(addTopPadding)
(widgets_fragment as WidgetsFragment).setupViews(addTopPadding) (widgets_fragment as WidgetsFragment).setupViews(addTopPadding)
} }
@@ -248,8 +252,8 @@ class MainActivity : SimpleActivity(), FlingListener {
override fun onConfigurationChanged(newConfig: Configuration) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
(all_apps_fragment as AllAppsFragment).onConfigurationChanged() (all_apps_fragment as? AllAppsFragment)?.onConfigurationChanged()
(widgets_fragment as WidgetsFragment).onConfigurationChanged() (widgets_fragment as? WidgetsFragment)?.onConfigurationChanged()
} }
override fun onTouchEvent(event: MotionEvent?): Boolean { override fun onTouchEvent(event: MotionEvent?): Boolean {
@@ -651,7 +655,10 @@ class MainActivity : SimpleActivity(), FlingListener {
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
fun getAllAppLaunchers(): ArrayList<AppLauncher> { fun getAllAppLaunchers(): ArrayList<AppLauncher> {
val hiddenIcons = hiddenIconsDB.getHiddenIcons().map { it.getIconIdentifier() } val hiddenIcons = hiddenIconsDB.getHiddenIcons().map {
it.getIconIdentifier()
}
val allApps = ArrayList<AppLauncher>() val allApps = ArrayList<AppLauncher>()
val intent = Intent(Intent.ACTION_MAIN, null) val intent = Intent(Intent.ACTION_MAIN, null)
intent.addCategory(Intent.CATEGORY_LAUNCHER) intent.addCategory(Intent.CATEGORY_LAUNCHER)

View File

@@ -511,11 +511,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
@SuppressLint("DrawAllocation") @SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas?) { override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
if (canvas == null) { if (canvas == null) {
return return
} }
super.onDraw(canvas)
if (cellXCoords.isEmpty()) { if (cellXCoords.isEmpty()) {
fillCellSizes() fillCellSizes()
} }