Search in sources :

Example 1 with OnUploadItemListener

use of net.osmand.plus.backup.NetworkWriter.OnUploadItemListener in project Osmand by osmandapp.

the class BackupExporter method exportItems.

private void exportItems() throws IOException {
    AtomicInteger dataProgress = new AtomicInteger(0);
    Set<Object> itemsProgress = Collections.synchronizedSet(new HashSet<>());
    Map<String, String> errors = new ConcurrentHashMap<>();
    OnUploadItemListener uploadItemListener = getOnUploadItemListener(itemsProgress, dataProgress, errors);
    OnDeleteFilesListener deleteFilesListener = getOnDeleteFilesListener(itemsProgress, dataProgress);
    NetworkWriter networkWriter = new NetworkWriter(backupHelper, uploadItemListener);
    writeItems(networkWriter);
    deleteFiles(deleteFilesListener);
    deleteOldFiles(deleteFilesListener);
    if (!isCancelled()) {
        backupHelper.updateBackupUploadTime();
    }
    if (listener != null) {
        listener.networkExportDone(errors);
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) OnDeleteFilesListener(net.osmand.plus.backup.BackupListeners.OnDeleteFilesListener) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) OnUploadItemListener(net.osmand.plus.backup.NetworkWriter.OnUploadItemListener)

Aggregations

ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 OnDeleteFilesListener (net.osmand.plus.backup.BackupListeners.OnDeleteFilesListener)1 OnUploadItemListener (net.osmand.plus.backup.NetworkWriter.OnUploadItemListener)1