Fix remarks remove loadingFileName
This commit is contained in:
parent
41df9fff9e
commit
2697095a99
2 changed files with 11 additions and 43 deletions
|
@ -440,16 +440,6 @@ public class GpxSelectionHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SelectedGpxFile getSelectedFileByLoadedFileName(String path) {
|
|
||||||
List<SelectedGpxFile> newList = new ArrayList<>(selectedGPXFiles);
|
|
||||||
for (SelectedGpxFile s : newList) {
|
|
||||||
if (path.endsWith("/" + s.getLoadedName())) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelectedGpxFile getSelectedFileByPath(String path) {
|
public SelectedGpxFile getSelectedFileByPath(String path) {
|
||||||
List<SelectedGpxFile> newList = new ArrayList<>(selectedGPXFiles);
|
List<SelectedGpxFile> newList = new ArrayList<>(selectedGPXFiles);
|
||||||
for (SelectedGpxFile s : newList) {
|
for (SelectedGpxFile s : newList) {
|
||||||
|
@ -462,10 +452,7 @@ public class GpxSelectionHelper {
|
||||||
|
|
||||||
public SelectedGpxFile getSelectedFileByName(String path) {
|
public SelectedGpxFile getSelectedFileByName(String path) {
|
||||||
for (SelectedGpxFile s : selectedGPXFiles) {
|
for (SelectedGpxFile s : selectedGPXFiles) {
|
||||||
if (path.equals(s.getLoadedName())) {
|
if (s.getGpxFile().path.endsWith("/" + path)) {
|
||||||
return s;
|
|
||||||
}
|
|
||||||
if (s.getLoadedName().isEmpty() && s.getGpxFile().path.endsWith("/" + path)) {
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -604,17 +591,11 @@ public class GpxSelectionHelper {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert gpx != null;
|
assert gpx != null;
|
||||||
sf = getSelectedFileByLoadedFileName(gpx.path);
|
|
||||||
if (sf == null) {
|
|
||||||
sf = getSelectedFileByPath(gpx.path);
|
sf = getSelectedFileByPath(gpx.path);
|
||||||
}
|
|
||||||
displayed = sf != null;
|
displayed = sf != null;
|
||||||
if (show) {
|
if (show) {
|
||||||
if (sf == null) {
|
if (sf == null) {
|
||||||
sf = new SelectedGpxFile();
|
sf = new SelectedGpxFile();
|
||||||
List<SelectedGpxFile> newSelectedGPXFiles = new ArrayList<>(selectedGPXFiles);
|
|
||||||
newSelectedGPXFiles.add(sf);
|
|
||||||
selectedGPXFiles = newSelectedGPXFiles;
|
|
||||||
}
|
}
|
||||||
if (dataItem != null) {
|
if (dataItem != null) {
|
||||||
if (dataItem.getColor() != 0) {
|
if (dataItem.getColor() != 0) {
|
||||||
|
@ -623,22 +604,13 @@ public class GpxSelectionHelper {
|
||||||
sf.setJoinSegments(dataItem.isJoinSegments());
|
sf.setJoinSegments(dataItem.isJoinSegments());
|
||||||
}
|
}
|
||||||
sf.setGpxFile(gpx, app);
|
sf.setGpxFile(gpx, app);
|
||||||
sf.setLoadedName("");
|
|
||||||
sf.notShowNavigationDialog = notShowNavigationDialog;
|
sf.notShowNavigationDialog = notShowNavigationDialog;
|
||||||
sf.selectedByUser = selectedByUser;
|
sf.selectedByUser = selectedByUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sf != null && sf.getLoadedName().isEmpty()) {
|
if (sf != null && sf.isLoaded()) {
|
||||||
if (displayed != show) {
|
if (displayed != show) {
|
||||||
List<SelectedGpxFile> newSelectedGPXFiles = new ArrayList<>(selectedGPXFiles);
|
addRemoveSelected(show, sf);
|
||||||
if (show) {
|
|
||||||
if (!newSelectedGPXFiles.contains(sf)) {
|
|
||||||
newSelectedGPXFiles.add(sf);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newSelectedGPXFiles.remove(sf);
|
|
||||||
}
|
|
||||||
selectedGPXFiles = newSelectedGPXFiles;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (syncGroup) {
|
if (syncGroup) {
|
||||||
|
@ -727,15 +699,6 @@ public class GpxSelectionHelper {
|
||||||
private boolean joinSegments;
|
private boolean joinSegments;
|
||||||
private boolean showCurrentTrack;
|
private boolean showCurrentTrack;
|
||||||
private boolean splitProcessed = false;
|
private boolean splitProcessed = false;
|
||||||
private String loadedName = "";
|
|
||||||
|
|
||||||
public String getLoadedName() {
|
|
||||||
return loadedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoadedName(String loadedName) {
|
|
||||||
this.loadedName = loadedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGpxFile(GPXFile gpxFile, OsmandApplication app) {
|
public void setGpxFile(GPXFile gpxFile, OsmandApplication app) {
|
||||||
this.gpxFile = gpxFile;
|
this.gpxFile = gpxFile;
|
||||||
|
@ -745,6 +708,10 @@ public class GpxSelectionHelper {
|
||||||
processPoints(app);
|
processPoints(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLoaded() {
|
||||||
|
return gpxFile.modifiedTime != 0 || gpxFile.showCurrentTrack;
|
||||||
|
}
|
||||||
|
|
||||||
public GPXTrackAnalysis getTrackAnalysis(OsmandApplication app) {
|
public GPXTrackAnalysis getTrackAnalysis(OsmandApplication app) {
|
||||||
if (modifiedTime != gpxFile.modifiedTime) {
|
if (modifiedTime != gpxFile.modifiedTime) {
|
||||||
update(app);
|
update(app);
|
||||||
|
|
|
@ -623,8 +623,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
SelectedGpxFile sf = selectedGpxHelper.getSelectedFileByName(gpxInfo.fileName);
|
SelectedGpxFile sf = selectedGpxHelper.getSelectedFileByName(gpxInfo.fileName);
|
||||||
if (sf == null) {
|
if (sf == null) {
|
||||||
sf = new SelectedGpxFile();
|
sf = new SelectedGpxFile();
|
||||||
|
sf.setGpxFile(new GPXFile(null), app);
|
||||||
}
|
}
|
||||||
sf.setLoadedName(gpxInfo.fileName);
|
sf.getGpxFile().path = gpxInfo.file.getPath();
|
||||||
selectedGpxHelper.addRemoveSelected(visible, sf);
|
selectedGpxHelper.addRemoveSelected(visible, sf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1884,7 +1885,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
SelectedGpxFile sgpx = getSelectedGpxFile(gpxInfo, app);
|
SelectedGpxFile sgpx = getSelectedGpxFile(gpxInfo, app);
|
||||||
GPXTrackAnalysis analysis = null;
|
GPXTrackAnalysis analysis = null;
|
||||||
if (sgpx != null) {
|
if (sgpx != null) {
|
||||||
if (sgpx.getLoadedName().isEmpty()) {
|
if (sgpx.isLoaded()) {
|
||||||
analysis = sgpx.getTrackAnalysis(app);
|
analysis = sgpx.getTrackAnalysis(app);
|
||||||
}
|
}
|
||||||
} else if (gpxInfo.currentlyRecordingTrack) {
|
} else if (gpxInfo.currentlyRecordingTrack) {
|
||||||
|
|
Loading…
Reference in a new issue