commit
dd773702f4
4 changed files with 10 additions and 4 deletions
|
@ -1037,7 +1037,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
|||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
File dir = getMyApplication().getAppPath(GPX_INDEX_DIR);
|
||||
if (folderName != null) {
|
||||
if (folderName != null && !dir.getName().equals(folderName)) {
|
||||
dir = new File(dir, folderName);
|
||||
}
|
||||
fileName += GPX_FILE_EXT;
|
||||
|
|
|
@ -76,6 +76,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
|||
sourceFileName = savedInstanceState.getString(SOURCE_FILE_NAME_KEY);
|
||||
sourceFolderName = savedInstanceState.getString(SOURCE_FOLDER_NAME_KEY);
|
||||
showSimplifiedButton = savedInstanceState.getBoolean(SHOW_SIMPLIFIED_BUTTON_KEY);
|
||||
} else {
|
||||
folderName = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getName();
|
||||
}
|
||||
|
||||
items.add(new TitleItem(getString(R.string.save_as_new_track)));
|
||||
|
@ -290,7 +292,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
|
|||
private File getFile(OsmandApplication app, String folderName, String fileName) {
|
||||
File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
File source = dir;
|
||||
if (folderName != null) {
|
||||
if (folderName != null && !dir.getName().equals(folderName)) {
|
||||
source = new File(dir, folderName);
|
||||
}
|
||||
source = new File(source, fileName + IndexConstants.GPX_FILE_EXT);
|
||||
|
|
|
@ -48,7 +48,8 @@ public class FolderListAdapter extends RecyclerView.Adapter<FolderListAdapter.Gr
|
|||
|
||||
private Collection<? extends String> getFolders() {
|
||||
List<File> dirs = new ArrayList<>();
|
||||
final File gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
File gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
dirs.add(gpxDir);
|
||||
Algorithms.collectDirs(gpxDir, dirs);
|
||||
List<String> dirItems = new ArrayList<>();
|
||||
for (File dir : dirs) {
|
||||
|
|
|
@ -894,7 +894,10 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
File fileDir = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), folderName == null ? "" : folderName);
|
||||
File fileDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
if (folderName != null && !fileDir.getName().equals(folderName)) {
|
||||
fileDir = new File(fileDir, folderName);
|
||||
}
|
||||
File toSave = new File(fileDir, fileName + GPX_FILE_EXT);
|
||||
new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue