Add global settings import

This commit is contained in:
Vitaliy 2020-10-22 13:32:28 +03:00
parent 46c5c04a01
commit 260adb89c1
3 changed files with 18 additions and 1 deletions

View file

@ -9,5 +9,6 @@ public enum ExportSettingsType {
CUSTOM_ROUTING,
AVOID_ROADS,
TRACKS,
MULTIMEDIA_NOTES
MULTIMEDIA_NOTES,
GLOBAL
}

View file

@ -576,6 +576,7 @@ public class SettingsHelper {
List<File> multimediaFilesList = new ArrayList<>();
List<File> tracksFilesList = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<GlobalSettingsItem> globalSettingsItems = new ArrayList<>();
for (SettingsItem item : settingsItems) {
switch (item.getType()) {
case PROFILE:
@ -625,6 +626,9 @@ public class SettingsHelper {
avoidRoads.addAll(avoidRoadsItem.getItems());
}
break;
case GLOBAL:
globalSettingsItems.add((GlobalSettingsItem) item);
break;
default:
break;
}
@ -657,6 +661,9 @@ public class SettingsHelper {
if (!tracksFilesList.isEmpty()) {
settingsToOperate.put(ExportSettingsType.TRACKS, tracksFilesList);
}
if (!globalSettingsItems.isEmpty()) {
settingsToOperate.put(ExportSettingsType.GLOBAL, globalSettingsItems);
}
return settingsToOperate;
}
}

View file

@ -31,6 +31,7 @@ import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
import net.osmand.util.Algorithms;
import net.osmand.view.ThreeStateCheckbox;
@ -262,6 +263,12 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
setupIcon(icon, R.drawable.ic_action_route_distance, itemSelected);
subText.setVisibility(View.GONE);
break;
case GLOBAL:
String name = ((GlobalSettingsItem) currentItem).getPublicName(app);
title.setText(name);
setupIcon(icon, R.drawable.ic_action_settings, itemSelected);
subText.setVisibility(View.GONE);
break;
default:
return child;
}
@ -338,6 +345,8 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
return R.string.shared_string_tracks;
case MULTIMEDIA_NOTES:
return R.string.audionotes_plugin_name;
case GLOBAL:
return R.string.general_settings_2;
default:
return R.string.access_empty_list;
}