Merge pull request #6277 from osmandapp/MarkersImprovements

Markers improvements
This commit is contained in:
Alexey 2018-11-14 12:23:13 +03:00 committed by GitHub
commit 30e6f105e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 13 deletions

View file

@ -645,7 +645,7 @@ public class MapMarkersHelper {
Iterator<MapMarker> iterator = groupMarkers.iterator();
while (iterator.hasNext()) {
MapMarker marker = iterator.next();
if (marker.id.equals(group.getId() + name + MapUtils.createShortLinkString(marker.point.getLatitude(), marker.point.getLongitude(), 15))) {
if (marker.id.equals(group.getId() + name + MapUtils.createShortLinkString(latLon.getLatitude(), latLon.getLongitude(), 15))) {
exists = true;
marker.favouritePoint = favouritePoint;
marker.wptPt = wptPt;

View file

@ -446,7 +446,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final GPXFile[] gpxFile = new GPXFile[1];
boolean disabled = !enabled;
if (groupIsDisabled && !group.wasShown() && !group.getWptCategories().isEmpty()) {
if (groupIsDisabled && !group.wasShown() && group.getWptCategories().size() > 1) {
group.setWasShown(true);
Bundle args = new Bundle();
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
@ -463,18 +463,13 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
group.setVisibleUntilRestart(disabled);
String gpxPath = group.getGpxPath();
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxPath);
if (disabled) {
if (selectedGpxFile != null) {
gpxFile[0] = selectedGpxFile.getGpxFile();
switchGpxVisibility(gpxFile[0], selectedGpxFile, false);
}
if (selectedGpxFile != null) {
gpxFile[0] = selectedGpxFile.getGpxFile();
} else {
if (selectedGpxFile == null) {
// TODO IO load in another thread ?
gpxFile[0] = GPXUtilities.loadGPXFile(app, new File(gpxPath));
switchGpxVisibility(gpxFile[0], null, true);
}
// TODO IO load in another thread ?
gpxFile[0] = GPXUtilities.loadGPXFile(app, new File(gpxPath));
}
switchGpxVisibility(gpxFile[0], selectedGpxFile, !disabled);
}
if(!disabled) {
mapMarkersHelper.enableGroup(group);
@ -482,7 +477,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
mapMarkersHelper.runSynchronization(group);
}
if (disabled) {
snackbar = Snackbar.make(holder.itemView, app.getString(R.string.group_will_be_removed_after_restart), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {