Create different files for different exports
This commit is contained in:
parent
7f41c6a542
commit
82722937f7
1 changed files with 16 additions and 4 deletions
|
@ -566,7 +566,7 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
|||
@Override
|
||||
public void onClick(int type) {
|
||||
List<OsmPoint> points = getPointsToExport();
|
||||
new BackupOpenstreetmapPointAsyncTask(type).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
new BackupOpenstreetmapPointAsyncTask(type, exportType).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||
points.toArray(new OsmPoint[points.size()]));
|
||||
}
|
||||
};
|
||||
|
@ -705,13 +705,12 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
|||
private File osmchange;
|
||||
private boolean oscFile;
|
||||
|
||||
public BackupOpenstreetmapPointAsyncTask(int fileType) {
|
||||
public BackupOpenstreetmapPointAsyncTask(int fileType, int exportType) {
|
||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||
oscFile = fileType == FILE_TYPE_OSC;
|
||||
osmchange = app.getAppPath(oscFile ? "poi_modification.osc" : "poi_modifications.gpx");
|
||||
osmchange = app.getAppPath(getFileName(exportType));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String doInBackground(OsmPoint... points) {
|
||||
if (oscFile) {
|
||||
|
@ -776,6 +775,19 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
|||
return null;
|
||||
}
|
||||
|
||||
private String getFileName(int exportType) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (exportType == EXPORT_TYPE_POI) {
|
||||
sb.append("osm_edits_modification");
|
||||
} else if (exportType == EXPORT_TYPE_NOTES) {
|
||||
sb.append("osm_notes_modification");
|
||||
} else {
|
||||
sb.append("osm_modification");
|
||||
}
|
||||
sb.append(oscFile ? ".osc" : ".gpx");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String getTagsString(OpenstreetmapPoint point) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String tag : point.getEntity().getTagKeySet()) {
|
||||
|
|
Loading…
Reference in a new issue