Changed result if nothing has been imported

This commit is contained in:
merkost 2023-07-10 23:27:10 +10:00
parent 6614539186
commit cd899849fe
2 changed files with 2 additions and 2 deletions

View File

@ -335,6 +335,7 @@ class SettingsActivity : SimpleActivity() {
when (importResult) { when (importResult) {
NotesHelper.ImportResult.IMPORT_OK -> toast(R.string.importing_successful) NotesHelper.ImportResult.IMPORT_OK -> toast(R.string.importing_successful)
NotesHelper.ImportResult.IMPORT_PARTIAL -> toast(R.string.importing_some_entries_failed) NotesHelper.ImportResult.IMPORT_PARTIAL -> toast(R.string.importing_some_entries_failed)
NotesHelper.ImportResult.IMPORT_NOTHING_NEW -> toast(R.string.no_new_items)
else -> toast(R.string.importing_failed) else -> toast(R.string.importing_failed)
} }
} }

View File

@ -115,9 +115,8 @@ class NotesHelper(val context: Context) {
} }
val result = when { val result = when {
skipped == notes.size -> ImportResult.IMPORT_NOTHING_NEW skipped == notes.size || imported == 0 -> ImportResult.IMPORT_NOTHING_NEW
imported == notes.size -> ImportResult.IMPORT_OK imported == notes.size -> ImportResult.IMPORT_OK
imported == 0 -> ImportResult.IMPORT_FAIL
else -> ImportResult.IMPORT_PARTIAL else -> ImportResult.IMPORT_PARTIAL
} }
callback(result) callback(result)