Moved "Importing" toast
This commit is contained in:
parent
39ca2d6079
commit
e244fd5a53
|
@ -80,7 +80,6 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private val getContent = registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
|
private val getContent = registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
toast(R.string.importing)
|
|
||||||
MessagesImporter(this).importMessages(uri)
|
MessagesImporter(this).importMessages(uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ class MessagesImporter(private val activity: SimpleActivity) {
|
||||||
val fileType = activity.contentResolver.getType(uri).orEmpty()
|
val fileType = activity.contentResolver.getType(uri).orEmpty()
|
||||||
val isXml = isXmlMimeType(fileType) || (uri.path?.endsWith("txt") == true && isFileXml(uri))
|
val isXml = isXmlMimeType(fileType) || (uri.path?.endsWith("txt") == true && isFileXml(uri))
|
||||||
if (isXml) {
|
if (isXml) {
|
||||||
|
activity.toast(R.string.importing)
|
||||||
getInputStreamFromUri(uri)!!.importXml()
|
getInputStreamFromUri(uri)!!.importXml()
|
||||||
} else {
|
} else {
|
||||||
importJson(uri)
|
importJson(uri)
|
||||||
|
|
Loading…
Reference in New Issue