예제 #1
0
 private void showGpxOnMap(final GPXUtilities.GPXFile result) {
   application.setGpxFileToDisplay(result, true);
   final GPXUtilities.WptPt moveTo = result.findPointToShow();
   if (moveTo != null) {
     mapView
         .getAnimatedDraggingThread()
         .startMoving(moveTo.lat, moveTo.lon, mapView.getZoom(), true);
   }
   mapView.refreshMap();
 }
예제 #2
0
  private String saveImport(final GPXUtilities.GPXFile gpxFile, final String fileName) {
    final String warning;

    if (gpxFile.isEmpty()) {
      warning = application.getString(R.string.error_reading_gpx);
    } else {
      final File importDir = application.getAppPath(IndexConstants.GPX_IMPORT_DIR);
      importDir.mkdirs();
      if (importDir.exists() && importDir.isDirectory() && importDir.canWrite()) {
        final GPXUtilities.WptPt pt = gpxFile.findPointToShow();
        final File toWrite = getFileToSave(fileName, importDir, pt);

        warning = GPXUtilities.writeGpxFile(toWrite, gpxFile, application);
        if (warning == null) {
          gpxFile.path = toWrite.getAbsolutePath();
        }
      } else {
        warning = application.getString(R.string.sd_dir_not_accessible);
      }
    }

    return warning;
  }