diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt index 74abd439f8..842421b324 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt @@ -167,7 +167,7 @@ class ImportExportPrefs @Inject constructor( if (!prefsEncryptionIsDisabled() && !assureMasterPasswordSet(activity, R.string.nav_export)) return TwoMessagesAlertDialog.showAlert(activity, resourceHelper.gs(R.string.nav_export), - resourceHelper.gs(R.string.export_to) + " " + fileToExport + " ?", + resourceHelper.gs(R.string.export_to) + " " + fileToExport.name + " ?", resourceHelper.gs(R.string.password_preferences_encrypt_prompt), { askForMasterPassIfNeeded(activity, R.string.preferences_export_canceled, then) }, null, R.drawable.ic_header_export) @@ -177,9 +177,8 @@ class ImportExportPrefs @Inject constructor( if (fileToImport.handler == PrefsFormatsHandler.ENCRYPTED) { if (!assureMasterPasswordSet(activity, R.string.nav_import)) return - TwoMessagesAlertDialog.showAlert(activity, resourceHelper.gs(R.string.nav_import), - resourceHelper.gs(R.string.import_from) + " " + fileToImport.file + " ?", + resourceHelper.gs(R.string.import_from) + " " + fileToImport.name + " ?", resourceHelper.gs(R.string.password_preferences_decrypt_prompt), { askForMasterPass(activity, R.string.preferences_import_canceled, then) }, null, R.drawable.ic_header_import) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt index 52910dfff1..d7e0d25115 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt @@ -34,6 +34,7 @@ enum class PrefsImportDir { @Parcelize data class PrefsFile( + val name: String, val file: File, val baseDir: File, val dirKind: PrefsImportDir, @@ -96,7 +97,7 @@ class PrefFileListProvider @Inject constructor( val detectedOld = !detectedNew && classicPrefsFormat.isPreferencesFile(it, contents) if (detectedNew || detectedOld) { val formatHandler = if (detectedNew) PrefsFormatsHandler.ENCRYPTED else PrefsFormatsHandler.CLASSIC - prefFiles.add(PrefsFile(it, path, PrefsImportDir.ROOT_DIR, formatHandler, metadataFor(loadMetadata, formatHandler, contents))) + prefFiles.add(PrefsFile(it.name , it, path, PrefsImportDir.ROOT_DIR, formatHandler, metadataFor(loadMetadata, formatHandler, contents))) } } @@ -104,7 +105,7 @@ class PrefFileListProvider @Inject constructor( aapsPath.walk().filter { it.isFile && it.name.endsWith(".json") }.forEach { val contents = storage.getFileContents(it) if (encryptedPrefsFormat.isPreferencesFile(it, contents)) { - prefFiles.add(PrefsFile(it, aapsPath, PrefsImportDir.AAPS_DIR, PrefsFormatsHandler.ENCRYPTED, metadataFor(loadMetadata, PrefsFormatsHandler.ENCRYPTED, contents))) + prefFiles.add(PrefsFile(it.name, it, aapsPath, PrefsImportDir.AAPS_DIR, PrefsFormatsHandler.ENCRYPTED, metadataFor(loadMetadata, PrefsFormatsHandler.ENCRYPTED, contents))) } } diff --git a/app/src/main/res/layout/dialog_alert_import_summary.xml b/app/src/main/res/layout/dialog_alert_import_summary.xml index fb6e5a0708..7871d47f59 100644 --- a/app/src/main/res/layout/dialog_alert_import_summary.xml +++ b/app/src/main/res/layout/dialog_alert_import_summary.xml @@ -1,30 +1,45 @@ - + xmlns:app="http://schemas.android.com/apk/res-auto"> - + -