Fix plan a route file name and segment calculation
This commit is contained in:
parent
c034f7deab
commit
5be444ab87
2 changed files with 17 additions and 44 deletions
|
@ -137,9 +137,11 @@ public class MeasurementEditingContext {
|
|||
void setSnapToRoadAppMode(ApplicationMode snapToRoadAppMode) {
|
||||
if (this.snapToRoadAppMode != null && snapToRoadAppMode != null
|
||||
&& !this.snapToRoadAppMode.getStringKey().equals(snapToRoadAppMode.getStringKey())) {
|
||||
if (calculationType == WHOLE_TRACK) {
|
||||
snappedToRoadPoints.clear();
|
||||
updateCacheForSnapIfNeeded(true);
|
||||
}
|
||||
}
|
||||
this.snapToRoadAppMode = snapToRoadAppMode;
|
||||
}
|
||||
|
||||
|
|
|
@ -1058,46 +1058,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
fragment.show(mapActivity.getSupportFragmentManager(), SaveAsNewTrackBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
|
||||
// private AlertDialog showAddToTrackDialog(final MapActivity mapActivity) {
|
||||
//
|
||||
// CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() {
|
||||
// @Override
|
||||
// public boolean processResult(GPXFile[] result) {
|
||||
// GPXFile gpxFile;
|
||||
// if (result != null && result.length > 0) {
|
||||
// gpxFile = result[0];
|
||||
// SelectedGpxFile selectedGpxFile = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path);
|
||||
// boolean showOnMap = selectedGpxFile != null;
|
||||
// saveExistingGpx(gpxFile, showOnMap, ActionType.ADD_SEGMENT, false);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// return GpxUiHelper.selectGPXFile(mapActivity, false, false, callbackWithObject, nightMode);
|
||||
// }
|
||||
|
||||
private void showAddToTrackDialog(final MapActivity mapActivity) {
|
||||
if (mapActivity != null) {
|
||||
SelectFileBottomSheet.showInstance(mapActivity.getSupportFragmentManager(),
|
||||
createAddToTrackFileListener(),ADD_TO_TRACK);
|
||||
}
|
||||
/*
|
||||
CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() {
|
||||
@Override
|
||||
public boolean processResult(GPXFile[] result) {
|
||||
GPXFile gpxFile;
|
||||
if (result != null && result.length > 0) {
|
||||
gpxFile = result[0];
|
||||
SelectedGpxFile selectedGpxFile = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path);
|
||||
boolean showOnMap = selectedGpxFile != null;
|
||||
saveExistingGpx(gpxFile, showOnMap, ActionType.ADD_SEGMENT, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
return GpxUiHelper.selectGPXFile(mapActivity, false, false, callbackWithObject, nightMode);*/
|
||||
}
|
||||
|
||||
private void applyMovePointMode() {
|
||||
|
@ -1444,14 +1409,20 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
private String getSuggestedName(File dir) {
|
||||
final String suggestedName = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
String displayedName = suggestedName;
|
||||
NewGpxData newGpxData = editingCtx.getNewGpxData();
|
||||
String displayedName;
|
||||
if (newGpxData == null) {
|
||||
final String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
|
||||
displayedName = suggestedName;
|
||||
File fout = new File(dir, suggestedName + GPX_FILE_EXT);
|
||||
int ind = 1;
|
||||
int ind = 0;
|
||||
while (fout.exists()) {
|
||||
displayedName = suggestedName + "_" + (++ind);
|
||||
fout = new File(dir, displayedName + GPX_FILE_EXT);
|
||||
}
|
||||
} else {
|
||||
displayedName = AndroidUtils.trimExtension(new File(newGpxData.getGpxFile().path).getName());
|
||||
}
|
||||
return displayedName;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue