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.Manifest
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.ContentResolver import android.content.ContentResolver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
@ -395,6 +396,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
if (sharedPreferenceManager.isGestureEnabled("date") && dateApp.first != null && dateApp.second != null) { if (sharedPreferenceManager.isGestureEnabled("date") && dateApp.first != null && dateApp.second != null) {
launcherApps.startMainActivity(dateApp.first!!.componentName, launcherApps.profiles[dateApp.second!!], null, null) launcherApps.startMainActivity(dateApp.first!!.componentName, launcherApps.profiles[dateApp.second!!], null, null)
} else { } else {
try {
startActivity( startActivity(
Intent( Intent(
Intent.makeMainSelectorActivity( Intent.makeMainSelectorActivity(
@ -404,6 +406,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
) )
) )
} }
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> <string name="open_app_menu">Avaa sovellusvalikko</string>
<!--App Menu--> <!--App Menu-->
<string name="no_calendar_app">Kalenteri-sovellusta ei löytynyt</string>
<string name="select_an_app">Valitse sovellus</string> <string name="select_an_app">Valitse sovellus</string>
<string name="search">Haku…</string> <string name="search">Haku…</string>

View file

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