Search in sources :

Example 11 with ExportSettingsType

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

the class BackupTypesFragment method onCategorySelected.

@Override
public void onCategorySelected(ExportSettingsCategory category, boolean selected) {
    super.onCategorySelected(category, selected);
    SettingsCategoryItems categoryItems = dataList.get(category);
    for (ExportSettingsType type : categoryItems.getTypes()) {
        backupHelper.getBackupTypePref(type).set(selected);
    }
}
Also used : SettingsCategoryItems(net.osmand.plus.settings.fragments.SettingsCategoryItems) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 12 with ExportSettingsType

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

the class VersionHistoryFragment method onCategorySelected.

@Override
public void onCategorySelected(ExportSettingsCategory category, boolean selected) {
    super.onCategorySelected(category, selected);
    SettingsCategoryItems categoryItems = dataList.get(category);
    for (ExportSettingsType type : categoryItems.getTypes()) {
        backupHelper.getVersionHistoryTypePref(type).set(selected);
    }
}
Also used : SettingsCategoryItems(net.osmand.plus.settings.fragments.SettingsCategoryItems) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 13 with ExportSettingsType

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

the class ItemViewHolder method getItemIcon.

@Nullable
protected Drawable getItemIcon(@NonNull SettingsItem item) {
    if (item instanceof ProfileSettingsItem) {
        ProfileSettingsItem profileItem = (ProfileSettingsItem) item;
        ApplicationMode mode = profileItem.getAppMode();
        return getContentIcon(mode.getIconRes());
    }
    ExportSettingsType type = ExportSettingsType.getExportSettingsTypeForItem(item);
    if (type != null) {
        return getContentIcon(type.getIconRes());
    }
    return null;
}
Also used : ProfileSettingsItem(net.osmand.plus.settings.backend.backup.items.ProfileSettingsItem) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType) Nullable(androidx.annotation.Nullable)

Example 14 with ExportSettingsType

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

the class BackupInfo method createFilteredFilesToUpload.

private void createFilteredFilesToUpload(@NonNull OsmandApplication app) {
    List<LocalFile> files = new ArrayList<>();
    BackupHelper helper = app.getBackupHelper();
    for (LocalFile localFile : filesToUpload) {
        ExportSettingsType type = localFile.item != null ? ExportSettingsType.getExportSettingsTypeForItem(localFile.item) : null;
        if (type != null && helper.getBackupTypePref(type).get()) {
            files.add(localFile);
        }
    }
    filteredFilesToUpload = files;
}
Also used : ArrayList(java.util.ArrayList) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 15 with ExportSettingsType

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

the class BackupInfo method createFilteredFilesToDelete.

private void createFilteredFilesToDelete(@NonNull OsmandApplication app) {
    List<RemoteFile> files = new ArrayList<>();
    BackupHelper helper = app.getBackupHelper();
    for (RemoteFile remoteFile : filesToDelete) {
        ExportSettingsType exportType = ExportSettingsType.getExportSettingsTypeForRemoteFile(remoteFile);
        if (exportType != null && helper.getBackupTypePref(exportType).get()) {
            files.add(remoteFile);
        }
    }
    filteredFilesToDelete = files;
}
Also used : ArrayList(java.util.ArrayList) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Aggregations

ExportSettingsType (net.osmand.plus.settings.backend.ExportSettingsType)36 ArrayList (java.util.ArrayList)18 List (java.util.List)10 SettingsCategoryItems (net.osmand.plus.settings.fragments.SettingsCategoryItems)9 ExportSettingsCategory (net.osmand.plus.settings.backend.ExportSettingsCategory)6 View (android.view.View)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 File (java.io.File)5 LinkedHashMap (java.util.LinkedHashMap)5 Nullable (androidx.annotation.Nullable)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 SettingsItem (net.osmand.plus.settings.backend.backup.items.SettingsItem)4 NonNull (androidx.annotation.NonNull)3 EnumMap (java.util.EnumMap)3 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)3 SuppressLint (android.annotation.SuppressLint)2 Typeface (android.graphics.Typeface)2 AsyncTask (android.os.AsyncTask)2