Create separate method for updating group wpt categories

This commit is contained in:
alex 2018-03-23 13:31:26 +02:00
parent 17f30ca428
commit e5060a43f7
2 changed files with 11 additions and 3 deletions

View file

@ -312,8 +312,6 @@ public class MapMarkersHelper {
markersDbHelper.addGroup(group);
addHistoryMarkersToGroup(group);
addToGroupsList(group);
} else if (group.wptCategories != null) {
markersDbHelper.updateGroupCategories(group.getId(), group.getWptCategoriesString());
}
runSynchronization(group);
}
@ -343,6 +341,16 @@ public class MapMarkersHelper {
}
}
public void updateGroupWptCategories(@NonNull MapMarkersGroup group, Set<String> wptCategories) {
String id = group.getId();
if (id != null) {
group.wptCategories = wptCategories;
if (wptCategories != null && isGroupSynced(id)) {
markersDbHelper.updateGroupCategories(id, group.getWptCategoriesString());
}
}
}
private void removeGroupActiveMarkers(MapMarkersGroup group, boolean updateGroup) {
if (group != null) {
markersDbHelper.removeActiveMarkersFromGroup(group.getId());

View file

@ -123,7 +123,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
}
MapMarkersGroup markersGr = mapMarkersHelper.getOrCreateGroup(new File(gpxFile.path));
markersGr.setWptCategories(selectedCategories);
mapMarkersHelper.updateGroupWptCategories(markersGr, selectedCategories);
mapMarkersHelper.syncWithMarkers(markersGr);