Enable markers group after re-importing
This commit is contained in:
parent
992c9cdc75
commit
f96baca404
8 changed files with 15 additions and 10 deletions
|
@ -121,7 +121,7 @@ public class FavouritesDbHelper {
|
|||
|
||||
private void addToMarkers(FavoriteGroup favGroup) {
|
||||
MapMarkersHelper helper = context.getMapMarkersHelper();
|
||||
helper.syncWithMarkers(helper.getOrCreateGroup(favGroup));
|
||||
helper.addOrEnableGroup(helper.getOrCreateGroup(favGroup));
|
||||
}
|
||||
|
||||
private File getInternalFile() {
|
||||
|
|
|
@ -309,11 +309,13 @@ public class MapMarkersHelper {
|
|||
return getMapMarker(favouritePoint) != null;
|
||||
}
|
||||
|
||||
public void syncWithMarkers(@NonNull MapMarkersGroup group) {
|
||||
public void addOrEnableGroup(@NonNull MapMarkersGroup group) {
|
||||
if (!isGroupSynced(group.getId())) {
|
||||
markersDbHelper.addGroup(group);
|
||||
addHistoryMarkersToGroup(group);
|
||||
addToGroupsList(group);
|
||||
} else if (group.isDisabled()) {
|
||||
updateGroupDisabled(group, false);
|
||||
}
|
||||
runSynchronization(group);
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
if (synced) {
|
||||
markersHelper.removeMarkersGroup(markersGr);
|
||||
} else {
|
||||
markersHelper.syncWithMarkers(markersGr);
|
||||
markersHelper.addOrEnableGroup(markersGr);
|
||||
}
|
||||
dismiss();
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
|
|
|
@ -418,7 +418,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
FavoriteGroup favGr = helper.getGroup(entry.getKey());
|
||||
MapMarkersGroup markersGr = markersHelper.getOrCreateGroup(favGr);
|
||||
if (entry.getValue().size() == favGr.points.size()) {
|
||||
markersHelper.syncWithMarkers(markersGr);
|
||||
markersHelper.addOrEnableGroup(markersGr);
|
||||
} else {
|
||||
for (FavouritePoint fp : entry.getValue()) {
|
||||
points.add(new LatLon(fp.getLatitude(), fp.getLongitude()));
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
|
|||
}
|
||||
|
||||
protected void addAndSyncGroup(MapMarkersGroup group) {
|
||||
getMyApplication().getMapMarkersHelper().syncWithMarkers(group);
|
||||
getMyApplication().getMapMarkersHelper().addOrEnableGroup(group);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
|
|||
MapMarkersGroup markersGr = mapMarkersHelper.getOrCreateGroup(new File(gpxFile.path));
|
||||
mapMarkersHelper.updateGroupWptCategories(markersGr, selectedCategories);
|
||||
|
||||
mapMarkersHelper.syncWithMarkers(markersGr);
|
||||
mapMarkersHelper.addOrEnableGroup(markersGr);
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
|
|
@ -413,7 +413,11 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
}
|
||||
}
|
||||
if (!synced) {
|
||||
mapMarkersHelper.syncWithMarkers(group);
|
||||
if (mapMarkersHelper.isGroupSynced(group.getId())) {
|
||||
mapMarkersHelper.runSynchronization(group);
|
||||
} else {
|
||||
mapMarkersHelper.addOrEnableGroup(group);
|
||||
}
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
|
@ -424,8 +428,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
if (group.getType() == MapMarkersGroup.GPX_TYPE && gpxFile[0] != null) {
|
||||
switchGpxVisibility(gpxFile[0], true);
|
||||
}
|
||||
mapMarkersHelper.updateGroupDisabled(group, false);
|
||||
mapMarkersHelper.syncWithMarkers(group);
|
||||
mapMarkersHelper.addOrEnableGroup(group);
|
||||
}
|
||||
});
|
||||
AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
|
||||
|
|
|
@ -587,7 +587,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
private void addMapMarkersSyncGroup() {
|
||||
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
||||
final MapMarkersGroup markersGr = markersHelper.getOrCreateGroup(getGpxDataItem().getFile());
|
||||
markersHelper.syncWithMarkers(markersGr);
|
||||
markersHelper.addOrEnableGroup(markersGr);
|
||||
GPXFile gpxFile = getTrackActivity().getGpx();
|
||||
if (gpxFile != null) {
|
||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, false);
|
||||
|
|
Loading…
Reference in a new issue