Search in sources :

Example 1 with ImportFileTask

use of net.osmand.plus.settings.backend.backup.ImportFileTask in project Osmand by osmandapp.

the class FileImportDuplicatesFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    settingsHelper = app.getFileSettingsHelper();
    ImportFileTask importTask = settingsHelper.getImportTask();
    if (importTask != null) {
        if (settingsItems == null) {
            settingsItems = importTask.getSelectedItems();
        }
        if (duplicatesList == null) {
            duplicatesList = importTask.getDuplicates();
        }
        if (file == null) {
            file = importTask.getFile();
        }
        Fragment target = getTargetFragment();
        if (target instanceof ImportSettingsFragment) {
            ImportListener importListener = ((ImportSettingsFragment) target).getImportListener();
            importTask.setImportListener(importListener);
        }
    }
}
Also used : ImportFileTask(net.osmand.plus.settings.backend.backup.ImportFileTask) Fragment(androidx.fragment.app.Fragment) ImportListener(net.osmand.plus.settings.backend.backup.SettingsHelper.ImportListener)

Example 2 with ImportFileTask

use of net.osmand.plus.settings.backend.backup.ImportFileTask in project Osmand by osmandapp.

the class FileImportSettingsFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    exportMode = false;
    settingsHelper = app.getFileSettingsHelper();
    ImportFileTask importTask = settingsHelper.getImportTask();
    if (importTask != null) {
        if (settingsItems == null) {
            settingsItems = importTask.getItems();
        }
        if (file == null) {
            file = importTask.getFile();
        }
        List<Object> duplicates = importTask.getDuplicates();
        List<SettingsItem> selectedItems = importTask.getSelectedItems();
        if (duplicates == null) {
            importTask.setDuplicatesListener(getDuplicatesListener());
        } else if (duplicates.isEmpty() && selectedItems != null && file != null) {
            settingsHelper.importSettings(file, selectedItems, "", 1, getImportListener());
        }
    }
}
Also used : ImportFileTask(net.osmand.plus.settings.backend.backup.ImportFileTask) SettingsItem(net.osmand.plus.settings.backend.backup.items.SettingsItem)

Aggregations

ImportFileTask (net.osmand.plus.settings.backend.backup.ImportFileTask)2 Fragment (androidx.fragment.app.Fragment)1 ImportListener (net.osmand.plus.settings.backend.backup.SettingsHelper.ImportListener)1 SettingsItem (net.osmand.plus.settings.backend.backup.items.SettingsItem)1