use of net.osmand.plus.backup.ImportBackupItemsTask.ImportItemsListener in project Osmand by osmandapp.
the class ImportBackupTask method onPostExecute.
@Override
protected void onPostExecute(@Nullable List<SettingsItem> items) {
if (items != null && importType != ImportType.CHECK_DUPLICATES) {
this.items = items;
} else {
selectedItems = items;
}
switch(importType) {
case COLLECT:
case COLLECT_AND_READ:
collectListener.onBackupCollectFinished(items != null, false, this.items, remoteFiles);
helper.importAsyncTasks.remove(key);
break;
case CHECK_DUPLICATES:
if (duplicatesListener != null) {
duplicatesListener.onDuplicatesChecked(duplicates, selectedItems);
}
helper.importAsyncTasks.remove(key);
break;
case IMPORT:
case IMPORT_FORCE_READ:
if (items != null && items.size() > 0) {
boolean forceReadData = importType == ImportType.IMPORT_FORCE_READ;
ImportItemsListener itemsListener = (succeed, needRestart) -> {
helper.importAsyncTasks.remove(key);
helper.finishImport(importListener, succeed, items, needRestart);
};
new ImportBackupItemsTask(app, importer, items, itemsListener, forceReadData).executeOnExecutor(app.getBackupHelper().getExecutor());
}
break;
}
}
Aggregations