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>
|
</intent-filter>
|
||||||
</activity>
|
</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
|
<activity
|
||||||
android:name=".activities.WidgetMonthlyConfigureActivity"
|
android:name=".activities.WidgetMonthlyConfigureActivity"
|
||||||
|
@@ -72,6 +72,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||||||
storeStoragePaths()
|
storeStoragePaths()
|
||||||
if (resources.getBoolean(R.bool.portrait_only))
|
if (resources.getBoolean(R.bool.portrait_only))
|
||||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||||
|
|
||||||
|
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||||
|
importEventsFromFile(intent.data!!.path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@@ -238,8 +242,13 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||||||
|
|
||||||
private fun importEvents() {
|
private fun importEvents() {
|
||||||
FilePickerDialog(this) {
|
FilePickerDialog(this) {
|
||||||
if (it.toLowerCase().endsWith(".ics")) {
|
importEventsFromFile(it)
|
||||||
ImportEventsDialog(this, it) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun importEventsFromFile(path: String) {
|
||||||
|
if (path.toLowerCase().endsWith(".ics")) {
|
||||||
|
ImportEventsDialog(this, path) {
|
||||||
if (it) {
|
if (it) {
|
||||||
updateViewPager()
|
updateViewPager()
|
||||||
}
|
}
|
||||||
@@ -248,7 +257,6 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||||||
toast(R.string.invalid_file_format)
|
toast(R.string.invalid_file_format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun tryExportEvents() {
|
private fun tryExportEvents() {
|
||||||
if (hasReadStoragePermission()) {
|
if (hasReadStoragePermission()) {
|
||||||
|
Reference in New Issue
Block a user