mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
suggest the Calendar at opening .ics files from a file manager
This commit is contained in:
@ -27,7 +27,17 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".activities.MainActivity"/>
|
||||
<activity android:name=".activities.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
|
||||
<data android:scheme="content"/>
|
||||
<data android:scheme="file"/>
|
||||
<data android:mimeType="text/x-vcalendar"/>
|
||||
<data android:mimeType="text/calendar"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.WidgetMonthlyConfigureActivity"
|
||||
|
@ -72,6 +72,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
storeStoragePaths()
|
||||
if (resources.getBoolean(R.bool.portrait_only))
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
|
||||
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
importEventsFromFile(intent.data!!.path)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@ -238,8 +242,13 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
|
||||
private fun importEvents() {
|
||||
FilePickerDialog(this) {
|
||||
if (it.toLowerCase().endsWith(".ics")) {
|
||||
ImportEventsDialog(this, it) {
|
||||
importEventsFromFile(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun importEventsFromFile(path: String) {
|
||||
if (path.toLowerCase().endsWith(".ics")) {
|
||||
ImportEventsDialog(this, path) {
|
||||
if (it) {
|
||||
updateViewPager()
|
||||
}
|
||||
@ -248,7 +257,6 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
toast(R.string.invalid_file_format)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryExportEvents() {
|
||||
if (hasReadStoragePermission()) {
|
||||
|
Reference in New Issue
Block a user