Merge pull request #10696 from osmandapp/fix_aidl_import
Fix aidl profile import
This commit is contained in:
commit
0b90e554f7
5 changed files with 71 additions and 237 deletions
|
@ -651,7 +651,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
protected void onNewIntent(final Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
intentHelper.parseLaunchIntents();
|
||||
if (!intentHelper.parseLaunchIntents()) {
|
||||
intentHelper.parseContentIntent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -102,7 +102,7 @@ class SettingsImportTask extends BaseLoadAsyncTask<Void, Void, String> {
|
|||
}
|
||||
} else {
|
||||
Map<ExportSettingsType, List<?>> allSettingsMap = getSettingsToOperate(pluginIndependentItems, false);
|
||||
List<SettingsItem> settingsList = settingsHelper.getFilteredSettingsItems(allSettingsMap, settingsTypes, false);
|
||||
List<SettingsItem> settingsList = settingsHelper.getFilteredSettingsItems(allSettingsMap, settingsTypes, pluginIndependentItems, false);
|
||||
settingsHelper.checkDuplicates(file, settingsList, settingsList, getDuplicatesListener(file, replace));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -480,19 +480,21 @@ public class SettingsHelper {
|
|||
typesMap.putAll(getMyPlacesItems());
|
||||
typesMap.putAll(getResourcesItems());
|
||||
|
||||
return getFilteredSettingsItems(typesMap, settingsTypes, export);
|
||||
return getFilteredSettingsItems(typesMap, settingsTypes, Collections.<SettingsItem>emptyList(), export);
|
||||
}
|
||||
|
||||
public List<SettingsItem> getFilteredSettingsItems(Map<ExportSettingsType, List<?>> allSettingsMap,
|
||||
List<ExportSettingsType> settingsTypes, boolean export) {
|
||||
List<SettingsItem> settingsItems = new ArrayList<>();
|
||||
public List<SettingsItem> getFilteredSettingsItems(
|
||||
Map<ExportSettingsType, List<?>> allSettingsMap, List<ExportSettingsType> settingsTypes,
|
||||
@NonNull List<SettingsItem> settingsItems, boolean export
|
||||
) {
|
||||
List<SettingsItem> filteredSettingsItems = new ArrayList<>();
|
||||
for (ExportSettingsType settingsType : settingsTypes) {
|
||||
List<?> settingsDataObjects = allSettingsMap.get(settingsType);
|
||||
if (settingsDataObjects != null) {
|
||||
settingsItems.addAll(prepareSettingsItems(settingsDataObjects, export));
|
||||
filteredSettingsItems.addAll(prepareSettingsItems(settingsDataObjects, settingsItems, export));
|
||||
}
|
||||
}
|
||||
return settingsItems;
|
||||
return filteredSettingsItems;
|
||||
}
|
||||
|
||||
public Map<ExportSettingsCategory, SettingsCategoryItems> getSettingsByCategory(boolean addProfiles) {
|
||||
|
@ -693,8 +695,8 @@ public class SettingsHelper {
|
|||
return files;
|
||||
}
|
||||
|
||||
public List<SettingsItem> prepareSettingsItems(List<?> data, boolean export) {
|
||||
List<SettingsItem> settingsItems = new ArrayList<>();
|
||||
public List<SettingsItem> prepareSettingsItems(List<?> data, List<SettingsItem> settingsItems, boolean export) {
|
||||
List<SettingsItem> result = new ArrayList<>();
|
||||
List<QuickAction> quickActions = new ArrayList<>();
|
||||
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
|
||||
List<ITileSource> tileSourceTemplates = new ArrayList<>();
|
||||
|
@ -719,13 +721,15 @@ public class SettingsHelper {
|
|||
try {
|
||||
File file = (File) object;
|
||||
if (file.getName().endsWith(IndexConstants.GPX_FILE_EXT)) {
|
||||
settingsItems.add(new GpxSettingsItem(app, file));
|
||||
result.add(new GpxSettingsItem(app, file));
|
||||
} else {
|
||||
settingsItems.add(new FileSettingsItem(app, file));
|
||||
result.add(new FileSettingsItem(app, file));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOG.warn("Trying to export unsuported file type", e);
|
||||
}
|
||||
} else if (object instanceof FileSettingsItem) {
|
||||
result.add((FileSettingsItem) object);
|
||||
} else if (object instanceof AvoidRoadInfo) {
|
||||
avoidRoads.add((AvoidRoadInfo) object);
|
||||
} else if (object instanceof ApplicationModeBean) {
|
||||
|
@ -746,65 +750,100 @@ public class SettingsHelper {
|
|||
} else if (object instanceof HistoryEntry) {
|
||||
historyEntries.add((HistoryEntry) object);
|
||||
} else if (object instanceof GlobalSettingsItem) {
|
||||
settingsItems.add((GlobalSettingsItem) object);
|
||||
result.add((GlobalSettingsItem) object);
|
||||
} else if (object instanceof OnlineRoutingEngine) {
|
||||
onlineRoutingEngines.add((OnlineRoutingEngine) object);
|
||||
}
|
||||
}
|
||||
if (!quickActions.isEmpty()) {
|
||||
settingsItems.add(new QuickActionsSettingsItem(app, quickActions));
|
||||
QuickActionsSettingsItem baseItem = getBaseItem(SettingsItemType.QUICK_ACTIONS, QuickActionsSettingsItem.class, settingsItems);
|
||||
result.add(new QuickActionsSettingsItem(app, baseItem, quickActions));
|
||||
}
|
||||
if (!poiUIFilters.isEmpty()) {
|
||||
settingsItems.add(new PoiUiFiltersSettingsItem(app, poiUIFilters));
|
||||
PoiUiFiltersSettingsItem baseItem = getBaseItem(SettingsItemType.POI_UI_FILTERS, PoiUiFiltersSettingsItem.class, settingsItems);
|
||||
result.add(new PoiUiFiltersSettingsItem(app, baseItem, poiUIFilters));
|
||||
}
|
||||
if (!tileSourceTemplates.isEmpty()) {
|
||||
settingsItems.add(new MapSourcesSettingsItem(app, tileSourceTemplates));
|
||||
MapSourcesSettingsItem baseItem = getBaseItem(SettingsItemType.MAP_SOURCES, MapSourcesSettingsItem.class, settingsItems);
|
||||
result.add(new MapSourcesSettingsItem(app, baseItem, tileSourceTemplates));
|
||||
}
|
||||
if (!avoidRoads.isEmpty()) {
|
||||
settingsItems.add(new AvoidRoadsSettingsItem(app, avoidRoads));
|
||||
AvoidRoadsSettingsItem baseItem = getBaseItem(SettingsItemType.AVOID_ROADS, AvoidRoadsSettingsItem.class, settingsItems);
|
||||
result.add(new AvoidRoadsSettingsItem(app, baseItem, avoidRoads));
|
||||
}
|
||||
if (!appModeBeans.isEmpty()) {
|
||||
for (ApplicationModeBean modeBean : appModeBeans) {
|
||||
if (export) {
|
||||
ApplicationMode mode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
|
||||
if (mode != null) {
|
||||
settingsItems.add(new ProfileSettingsItem(app, mode));
|
||||
result.add(new ProfileSettingsItem(app, mode));
|
||||
}
|
||||
} else {
|
||||
settingsItems.add(new ProfileSettingsItem(app, null, modeBean));
|
||||
result.add(new ProfileSettingsItem(app, getBaseProfileSettingsItem(modeBean, settingsItems), modeBean));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!osmNotesPointList.isEmpty()) {
|
||||
settingsItems.add(new OsmNotesSettingsItem(app, osmNotesPointList));
|
||||
OsmNotesSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_NOTES, OsmNotesSettingsItem.class, settingsItems);
|
||||
result.add(new OsmNotesSettingsItem(app, baseItem, osmNotesPointList));
|
||||
}
|
||||
if (!osmEditsPointList.isEmpty()) {
|
||||
settingsItems.add(new OsmEditsSettingsItem(app, osmEditsPointList));
|
||||
OsmEditsSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_EDITS, OsmEditsSettingsItem.class, settingsItems);
|
||||
result.add(new OsmEditsSettingsItem(app, baseItem, osmEditsPointList));
|
||||
}
|
||||
if (!favoriteGroups.isEmpty()) {
|
||||
settingsItems.add(new FavoritesSettingsItem(app, favoriteGroups));
|
||||
FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class, settingsItems);
|
||||
result.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups));
|
||||
}
|
||||
if (!markersGroups.isEmpty()) {
|
||||
List<MapMarker> mapMarkers = new ArrayList<>();
|
||||
for (MapMarkersGroup group : markersGroups) {
|
||||
mapMarkers.addAll(group.getMarkers());
|
||||
}
|
||||
settingsItems.add(new MarkersSettingsItem(app, mapMarkers));
|
||||
MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class, settingsItems);
|
||||
result.add(new MarkersSettingsItem(app, baseItem, mapMarkers));
|
||||
}
|
||||
if (!markersHistoryGroups.isEmpty()) {
|
||||
List<MapMarker> mapMarkers = new ArrayList<>();
|
||||
for (MapMarkersGroup group : markersHistoryGroups) {
|
||||
mapMarkers.addAll(group.getMarkers());
|
||||
}
|
||||
settingsItems.add(new HistoryMarkersSettingsItem(app, mapMarkers));
|
||||
HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class, settingsItems);
|
||||
result.add(new HistoryMarkersSettingsItem(app, baseItem, mapMarkers));
|
||||
}
|
||||
if (!historyEntries.isEmpty()) {
|
||||
settingsItems.add(new SearchHistorySettingsItem(app, historyEntries));
|
||||
SearchHistorySettingsItem baseItem = getBaseItem(SettingsItemType.SEARCH_HISTORY, SearchHistorySettingsItem.class, settingsItems);
|
||||
result.add(new SearchHistorySettingsItem(app, baseItem, historyEntries));
|
||||
}
|
||||
if (!onlineRoutingEngines.isEmpty()) {
|
||||
settingsItems.add(new OnlineRoutingSettingsItem(app, onlineRoutingEngines));
|
||||
OnlineRoutingSettingsItem baseItem = getBaseItem(SettingsItemType.ONLINE_ROUTING_ENGINES, OnlineRoutingSettingsItem.class, settingsItems);
|
||||
result.add(new OnlineRoutingSettingsItem(app, baseItem, onlineRoutingEngines));
|
||||
}
|
||||
return settingsItems;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ProfileSettingsItem getBaseProfileSettingsItem(ApplicationModeBean modeBean, List<SettingsItem> settingsItems) {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == SettingsItemType.PROFILE) {
|
||||
ProfileSettingsItem profileItem = (ProfileSettingsItem) settingsItem;
|
||||
ApplicationModeBean bean = profileItem.getModeBean();
|
||||
if (Algorithms.objectEquals(bean.stringKey, modeBean.stringKey) && Algorithms.objectEquals(bean.userProfileName, modeBean.userProfileName)) {
|
||||
return profileItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private <T> T getBaseItem(SettingsItemType settingsItemType, Class<T> clazz, List<SettingsItem> settingsItems) {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == settingsItemType && clazz.isInstance(settingsItem)) {
|
||||
return clazz.cast(settingsItem);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Map<ExportSettingsCategory, SettingsCategoryItems> getSettingsToOperateByCategory(List<SettingsItem> items, boolean importComplete) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.commons.logging.Log;
|
|||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -150,7 +151,7 @@ public class ExportSettingsFragment extends BaseSettingsListFragment {
|
|||
showExportProgressDialog();
|
||||
File tempDir = FileUtils.getTempDir(app);
|
||||
String fileName = getFileName();
|
||||
List<SettingsItem> items = app.getSettingsHelper().prepareSettingsItems(adapter.getData(), true);
|
||||
List<SettingsItem> items = app.getSettingsHelper().prepareSettingsItems(adapter.getData(), Collections.<SettingsItem>emptyList(), true);
|
||||
progress.setMax(getMaxProgress(items));
|
||||
app.getSettingsHelper().exportSettings(tempDir, fileName, getSettingsExportListener(), items, true);
|
||||
}
|
||||
|
|
|
@ -18,57 +18,24 @@ import androidx.fragment.app.FragmentManager;
|
|||
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||
import net.osmand.plus.AppInitializer;
|
||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.SQLiteTileSource;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.download.ReloadIndexesTask;
|
||||
import net.osmand.plus.download.ReloadIndexesTask.ReloadIndexesListener;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import net.osmand.plus.mapmarkers.MapMarker;
|
||||
import net.osmand.plus.mapmarkers.MapMarkersGroup;
|
||||
import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine;
|
||||
import net.osmand.plus.osmedit.OpenstreetmapPoint;
|
||||
import net.osmand.plus.osmedit.OsmNotesPoint;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
|
||||
import net.osmand.plus.settings.backend.ExportSettingsType;
|
||||
import net.osmand.plus.settings.backend.backup.AvoidRoadsSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.FavoritesSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.FileSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.GpxSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.HistoryMarkersSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.MapSourcesSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.MarkersSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.OnlineRoutingSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.OsmEditsSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.OsmNotesSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.PoiUiFiltersSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.ProfileSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.QuickActionsSettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.SearchHistorySettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportAsyncTask;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsItem;
|
||||
import net.osmand.plus.settings.backend.backup.SettingsItemType;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImportSettingsFragment extends BaseSettingsListFragment {
|
||||
|
@ -177,7 +144,7 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
|
|||
}
|
||||
|
||||
private void importItems() {
|
||||
List<SettingsItem> selectedItems = getSettingsItemsFromData(adapter.getData());
|
||||
List<SettingsItem> selectedItems = settingsHelper.prepareSettingsItems(adapter.getData(), settingsItems, false);
|
||||
if (file != null && settingsItems != null) {
|
||||
duplicateStartTime = System.currentTimeMillis();
|
||||
settingsHelper.checkDuplicates(file, settingsItems, selectedItems, getDuplicatesListener());
|
||||
|
@ -272,181 +239,6 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
|
|||
this.settingsItems = settingsItems;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ProfileSettingsItem getBaseProfileSettingsItem(ApplicationModeBean modeBean) {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == SettingsItemType.PROFILE) {
|
||||
ProfileSettingsItem profileItem = (ProfileSettingsItem) settingsItem;
|
||||
ApplicationModeBean bean = profileItem.getModeBean();
|
||||
if (Algorithms.objectEquals(bean.stringKey, modeBean.stringKey) && Algorithms.objectEquals(bean.userProfileName, modeBean.userProfileName)) {
|
||||
return profileItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private QuickActionsSettingsItem getBaseQuickActionsSettingsItem() {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == SettingsItemType.QUICK_ACTIONS) {
|
||||
return (QuickActionsSettingsItem) settingsItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PoiUiFiltersSettingsItem getBasePoiUiFiltersSettingsItem() {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == SettingsItemType.POI_UI_FILTERS) {
|
||||
return (PoiUiFiltersSettingsItem) settingsItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private MapSourcesSettingsItem getBaseMapSourcesSettingsItem() {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == SettingsItemType.MAP_SOURCES) {
|
||||
return (MapSourcesSettingsItem) settingsItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private AvoidRoadsSettingsItem getBaseAvoidRoadsSettingsItem() {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == SettingsItemType.AVOID_ROADS) {
|
||||
return (AvoidRoadsSettingsItem) settingsItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private <T> T getBaseItem(SettingsItemType settingsItemType, Class<T> clazz) {
|
||||
for (SettingsItem settingsItem : settingsItems) {
|
||||
if (settingsItem.getType() == settingsItemType && clazz.isInstance(settingsItem)) {
|
||||
return clazz.cast(settingsItem);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<SettingsItem> getSettingsItemsFromData(List<?> data) {
|
||||
List<SettingsItem> settingsItems = new ArrayList<>();
|
||||
List<ApplicationModeBean> appModeBeans = new ArrayList<>();
|
||||
List<QuickAction> quickActions = new ArrayList<>();
|
||||
List<PoiUIFilter> poiUIFilters = new ArrayList<>();
|
||||
List<ITileSource> tileSourceTemplates = new ArrayList<>();
|
||||
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
|
||||
List<OsmNotesPoint> osmNotesPointList = new ArrayList<>();
|
||||
List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>();
|
||||
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
|
||||
List<MapMarkersGroup> markersGroups = new ArrayList<>();
|
||||
List<MapMarkersGroup> markersHistoryGroups = new ArrayList<>();
|
||||
List<HistoryEntry> historyEntries = new ArrayList<>();
|
||||
List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>();
|
||||
for (Object object : data) {
|
||||
if (object instanceof ApplicationModeBean) {
|
||||
appModeBeans.add((ApplicationModeBean) object);
|
||||
} else if (object instanceof QuickAction) {
|
||||
quickActions.add((QuickAction) object);
|
||||
} else if (object instanceof PoiUIFilter) {
|
||||
poiUIFilters.add((PoiUIFilter) object);
|
||||
} else if (object instanceof TileSourceTemplate || object instanceof SQLiteTileSource) {
|
||||
tileSourceTemplates.add((ITileSource) object);
|
||||
} else if (object instanceof File) {
|
||||
File file = (File) object;
|
||||
if (file.getName().endsWith(IndexConstants.GPX_FILE_EXT)) {
|
||||
settingsItems.add(new GpxSettingsItem(app, file));
|
||||
} else {
|
||||
settingsItems.add(new FileSettingsItem(app, file));
|
||||
}
|
||||
} else if (object instanceof FileSettingsItem) {
|
||||
settingsItems.add((FileSettingsItem) object);
|
||||
} else if (object instanceof AvoidRoadInfo) {
|
||||
avoidRoads.add((AvoidRoadInfo) object);
|
||||
} else if (object instanceof OsmNotesPoint) {
|
||||
osmNotesPointList.add((OsmNotesPoint) object);
|
||||
} else if (object instanceof OpenstreetmapPoint) {
|
||||
osmEditsPointList.add((OpenstreetmapPoint) object);
|
||||
} else if (object instanceof FavoriteGroup) {
|
||||
favoriteGroups.add((FavoriteGroup) object);
|
||||
} else if (object instanceof GlobalSettingsItem) {
|
||||
settingsItems.add((GlobalSettingsItem) object);
|
||||
} else if (object instanceof MapMarkersGroup) {
|
||||
MapMarkersGroup markersGroup = (MapMarkersGroup) object;
|
||||
if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
|
||||
markersGroups.add((MapMarkersGroup) object);
|
||||
} else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
|
||||
markersHistoryGroups.add((MapMarkersGroup) object);
|
||||
}
|
||||
} else if (object instanceof HistoryEntry) {
|
||||
historyEntries.add((HistoryEntry) object);
|
||||
} else if (object instanceof OnlineRoutingEngine) {
|
||||
onlineRoutingEngines.add((OnlineRoutingEngine) object);
|
||||
}
|
||||
}
|
||||
if (!appModeBeans.isEmpty()) {
|
||||
for (ApplicationModeBean modeBean : appModeBeans) {
|
||||
settingsItems.add(new ProfileSettingsItem(app, getBaseProfileSettingsItem(modeBean), modeBean));
|
||||
}
|
||||
}
|
||||
if (!quickActions.isEmpty()) {
|
||||
settingsItems.add(new QuickActionsSettingsItem(app, getBaseQuickActionsSettingsItem(), quickActions));
|
||||
}
|
||||
if (!poiUIFilters.isEmpty()) {
|
||||
settingsItems.add(new PoiUiFiltersSettingsItem(app, getBasePoiUiFiltersSettingsItem(), poiUIFilters));
|
||||
}
|
||||
if (!tileSourceTemplates.isEmpty()) {
|
||||
settingsItems.add(new MapSourcesSettingsItem(app, getBaseMapSourcesSettingsItem(), tileSourceTemplates));
|
||||
}
|
||||
if (!avoidRoads.isEmpty()) {
|
||||
settingsItems.add(new AvoidRoadsSettingsItem(app, getBaseAvoidRoadsSettingsItem(), avoidRoads));
|
||||
}
|
||||
if (!osmNotesPointList.isEmpty()) {
|
||||
OsmNotesSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_NOTES, OsmNotesSettingsItem.class);
|
||||
settingsItems.add(new OsmNotesSettingsItem(app, baseItem, osmNotesPointList));
|
||||
}
|
||||
if (!osmEditsPointList.isEmpty()) {
|
||||
OsmEditsSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_EDITS, OsmEditsSettingsItem.class);
|
||||
settingsItems.add(new OsmEditsSettingsItem(app, baseItem, osmEditsPointList));
|
||||
}
|
||||
if (!favoriteGroups.isEmpty()) {
|
||||
FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class);
|
||||
settingsItems.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups));
|
||||
}
|
||||
if (!markersGroups.isEmpty()) {
|
||||
List<MapMarker> mapMarkers = new ArrayList<>();
|
||||
for (MapMarkersGroup group : markersGroups) {
|
||||
mapMarkers.addAll(group.getMarkers());
|
||||
}
|
||||
MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class);
|
||||
settingsItems.add(new MarkersSettingsItem(app, baseItem, mapMarkers));
|
||||
}
|
||||
if (!markersHistoryGroups.isEmpty()) {
|
||||
List<MapMarker> mapMarkers = new ArrayList<>();
|
||||
for (MapMarkersGroup group : markersHistoryGroups) {
|
||||
mapMarkers.addAll(group.getMarkers());
|
||||
}
|
||||
HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class);
|
||||
settingsItems.add(new HistoryMarkersSettingsItem(app, baseItem, mapMarkers));
|
||||
}
|
||||
if (!historyEntries.isEmpty()) {
|
||||
SearchHistorySettingsItem baseItem = getBaseItem(SettingsItemType.SEARCH_HISTORY, SearchHistorySettingsItem.class);
|
||||
settingsItems.add(new SearchHistorySettingsItem(app, baseItem, historyEntries));
|
||||
}
|
||||
if (!onlineRoutingEngines.isEmpty()) {
|
||||
OnlineRoutingSettingsItem baseItem = getBaseItem(SettingsItemType.ONLINE_ROUTING_ENGINES, OnlineRoutingSettingsItem.class);
|
||||
settingsItems.add(new OnlineRoutingSettingsItem(app, baseItem, onlineRoutingEngines));
|
||||
}
|
||||
return settingsItems;
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue