Fix crash when no Calendar app found on date click

This commit is contained in:
Alraj Dev 2024-10-24 15:14:54 +05:30
commit 9757f9415f
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,6 +396,7 @@ 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 {
try {
startActivity(
Intent(
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>
<!--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>