Fixes bug: unable to import favourites from GPX. Fixes #2283
This commit is contained in:
parent
6f4a48451b
commit
e3f5765c3e
1 changed files with 13 additions and 16 deletions
|
@ -248,8 +248,7 @@ public class GpxImportHelper {
|
|||
} else {
|
||||
if (save) {
|
||||
new SaveAsyncTask(result, name).execute();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
showGpxOnMap(result);
|
||||
}
|
||||
}
|
||||
|
@ -265,6 +264,7 @@ public class GpxImportHelper {
|
|||
warning = application.getString(R.string.error_reading_gpx);
|
||||
} else {
|
||||
final File importDir = application.getAppPath(IndexConstants.GPX_IMPORT_DIR);
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
importDir.mkdirs();
|
||||
if (importDir.exists() && importDir.isDirectory() && importDir.canWrite()) {
|
||||
final GPXUtilities.WptPt pt = gpxFile.findPointToShow();
|
||||
|
@ -352,20 +352,17 @@ public class GpxImportHelper {
|
|||
}
|
||||
|
||||
private List<FavouritePoint> asFavourites(final List<GPXUtilities.WptPt> wptPts) {
|
||||
final List<FavouritePoint> favourites = new ArrayList<FavouritePoint>();
|
||||
final List<FavouritePoint> favourites = new ArrayList<>();
|
||||
|
||||
for (GPXUtilities.WptPt p : wptPts) {
|
||||
if (p.category != null) {
|
||||
final FavouritePoint fp = new FavouritePoint(p.lat, p.lon, p.name, p.category);
|
||||
if (p.desc!=null) {
|
||||
if (p.desc != null) {
|
||||
fp.setDescription(p.desc);
|
||||
}
|
||||
favourites.add(fp);
|
||||
} else if (p.name != null) {
|
||||
int c;
|
||||
if ((c = p.name.lastIndexOf('_')) != -1) {
|
||||
favourites.add(new FavouritePoint(p.lat, p.lon, p.name.substring(0, c), p.name.substring(c + 1)));
|
||||
}
|
||||
favourites.add(new FavouritePoint(p.lat, p.lon, p.name, ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue