Merge pull request #9 from alrajdev/main

Fix crash when no Calendar app found on date click
This commit is contained in:
ottop 2024-10-24 12:53:15 +03:00 committed by GitHub
commit b625a80e78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View file

@ -2,6 +2,7 @@ package eu.ottop.yamlauncher
import android.Manifest
import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.ContentResolver
import android.content.Context
import android.content.Intent
@ -395,14 +396,19 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
if (sharedPreferenceManager.isGestureEnabled("date") && dateApp.first != null && dateApp.second != null) {
launcherApps.startMainActivity(dateApp.first!!.componentName, launcherApps.profiles[dateApp.second!!], null, null)
} else {
startActivity(
Intent(
Intent.makeMainSelectorActivity(
Intent.ACTION_MAIN,
Intent.CATEGORY_APP_CALENDAR
try {
startActivity(
Intent(
Intent.makeMainSelectorActivity(
Intent.ACTION_MAIN,
Intent.CATEGORY_APP_CALENDAR
)
)
)
)
}
catch(_: ActivityNotFoundException) {
Toast.makeText(this, getString(R.string.no_calendar_app), Toast.LENGTH_SHORT).show()
}
}
}
}

View file

@ -13,6 +13,7 @@
<string name="open_app_menu">Avaa sovellusvalikko</string>
<!--App Menu-->
<string name="no_calendar_app">Kalenteri-sovellusta ei löytynyt</string>
<string name="select_an_app">Valitse sovellus</string>
<string name="search">Haku…</string>

View file

@ -12,6 +12,8 @@
<string name="open_app_menu">Open App Menu</string>
<string name="no_calendar_app">No Calendar app found</string>
<!--App Menu-->
<string name="select_an_app">Select an app</string>