1
0
mirror of https://github.com/etesync/android synced 2025-02-02 10:51:10 +00:00

Import from file: dismiss dialog and print an error in a missed error case.

This commit is contained in:
Tom Hacohen 2019-02-23 21:24:26 +00:00
parent 51a29b4401
commit 4fb49cf5f4

View File

@ -139,7 +139,8 @@ class ImportFragment : DialogFragment() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
REQUEST_CODE -> if (resultCode == Activity.RESULT_OK) {
REQUEST_CODE -> {
if (resultCode == Activity.RESULT_OK) {
if (data != null) {
// Get the URI of the selected file
val uri = data.data
@ -149,7 +150,14 @@ class ImportFragment : DialogFragment() {
Thread(ImportCalendarsLoader()).start()
} catch (e: Exception) {
App.log.severe("File select error: " + e.localizedMessage)
App.log.severe("File select error: ${e.message}")
val importResult = ImportResult()
importResult.e = e
(activity as ResultFragment.OnImportCallback).onImportResult(importResult)
dismissAllowingStateLoss()
}
}
@ -157,6 +165,7 @@ class ImportFragment : DialogFragment() {
dismissAllowingStateLoss()
}
}
}
super.onActivityResult(requestCode, resultCode, data)
}