mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Fix crash when no Calendar app found on date click
This commit is contained in:
parent
df9ceb07b8
commit
9757f9415f
3 changed files with 15 additions and 6 deletions
|
|
@ -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,14 +396,19 @@ 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 {
|
||||||
startActivity(
|
try {
|
||||||
Intent(
|
startActivity(
|
||||||
Intent.makeMainSelectorActivity(
|
Intent(
|
||||||
Intent.ACTION_MAIN,
|
Intent.makeMainSelectorActivity(
|
||||||
Intent.CATEGORY_APP_CALENDAR
|
Intent.ACTION_MAIN,
|
||||||
|
Intent.CATEGORY_APP_CALENDAR
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
catch(_: ActivityNotFoundException) {
|
||||||
|
Toast.makeText(this, getString(R.string.no_calendar_app), Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue