Fix gpx markers issues for single category
This commit is contained in:
parent
5bf7208791
commit
82684ff41e
2 changed files with 18 additions and 24 deletions
|
@ -645,7 +645,7 @@ public class MapMarkersHelper {
|
||||||
Iterator<MapMarker> iterator = groupMarkers.iterator();
|
Iterator<MapMarker> iterator = groupMarkers.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
MapMarker marker = iterator.next();
|
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;
|
exists = true;
|
||||||
marker.favouritePoint = favouritePoint;
|
marker.favouritePoint = favouritePoint;
|
||||||
marker.wptPt = wptPt;
|
marker.wptPt = wptPt;
|
||||||
|
|
|
@ -446,34 +446,29 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||||
final GPXFile[] gpxFile = new GPXFile[1];
|
final GPXFile[] gpxFile = new GPXFile[1];
|
||||||
boolean disabled = !enabled;
|
boolean disabled = !enabled;
|
||||||
|
|
||||||
if (groupIsDisabled && !group.wasShown() && !group.getWptCategories().isEmpty()) {
|
|
||||||
group.setWasShown(true);
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
|
|
||||||
args.putString(SelectWptCategoriesBottomSheetDialogFragment.ACTIVE_CATEGORIES_KEY, group.getWptCategoriesString());
|
|
||||||
args.putBoolean(SelectWptCategoriesBottomSheetDialogFragment.UPDATE_CATEGORIES_KEY, true);
|
|
||||||
|
|
||||||
SelectWptCategoriesBottomSheetDialogFragment fragment = new SelectWptCategoriesBottomSheetDialogFragment();
|
|
||||||
fragment.setArguments(args);
|
|
||||||
fragment.setUsedOnMap(false);
|
|
||||||
fragment.show(mapActivity.getSupportFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG);
|
|
||||||
}
|
|
||||||
mapMarkersHelper.updateGroupDisabled(group, disabled);
|
mapMarkersHelper.updateGroupDisabled(group, disabled);
|
||||||
if (group.getType() == MapMarkersGroup.GPX_TYPE) {
|
if (group.getType() == MapMarkersGroup.GPX_TYPE) {
|
||||||
group.setVisibleUntilRestart(disabled);
|
group.setVisibleUntilRestart(disabled);
|
||||||
String gpxPath = group.getGpxPath();
|
String gpxPath = group.getGpxPath();
|
||||||
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxPath);
|
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxPath);
|
||||||
if (disabled) {
|
if (selectedGpxFile != null) {
|
||||||
if (selectedGpxFile != null) {
|
gpxFile[0] = selectedGpxFile.getGpxFile();
|
||||||
gpxFile[0] = selectedGpxFile.getGpxFile();
|
|
||||||
switchGpxVisibility(gpxFile[0], selectedGpxFile, false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (selectedGpxFile == null) {
|
// TODO IO load in another thread ?
|
||||||
// TODO IO load in another thread ?
|
gpxFile[0] = GPXUtilities.loadGPXFile(app, new File(gpxPath));
|
||||||
gpxFile[0] = GPXUtilities.loadGPXFile(app, new File(gpxPath));
|
}
|
||||||
switchGpxVisibility(gpxFile[0], null, true);
|
switchGpxVisibility(gpxFile[0], selectedGpxFile, !disabled);
|
||||||
}
|
if (enabled && !group.wasShown() && gpxFile[0] != null && gpxFile[0].getWaypointCategories(false).size() > 1) {
|
||||||
|
group.setWasShown(true);
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
|
||||||
|
args.putString(SelectWptCategoriesBottomSheetDialogFragment.ACTIVE_CATEGORIES_KEY, group.getWptCategoriesString());
|
||||||
|
args.putBoolean(SelectWptCategoriesBottomSheetDialogFragment.UPDATE_CATEGORIES_KEY, true);
|
||||||
|
|
||||||
|
SelectWptCategoriesBottomSheetDialogFragment fragment = new SelectWptCategoriesBottomSheetDialogFragment();
|
||||||
|
fragment.setArguments(args);
|
||||||
|
fragment.setUsedOnMap(false);
|
||||||
|
fragment.show(mapActivity.getSupportFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!disabled) {
|
if(!disabled) {
|
||||||
|
@ -482,7 +477,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||||
mapMarkersHelper.runSynchronization(group);
|
mapMarkersHelper.runSynchronization(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
snackbar = Snackbar.make(holder.itemView, app.getString(R.string.group_will_be_removed_after_restart), Snackbar.LENGTH_LONG)
|
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() {
|
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue