Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-03-23 18:06:30 +01:00
commit a081ae4e4b
8 changed files with 15 additions and 10 deletions

View file

@ -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() {

View file

@ -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);
}

View file

@ -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());

View file

@ -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()));

View file

@ -58,7 +58,7 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
}
protected void addAndSyncGroup(MapMarkersGroup group) {
getMyApplication().getMapMarkersHelper().syncWithMarkers(group);
getMyApplication().getMapMarkersHelper().addOrEnableGroup(group);
dismiss();
}

View file

@ -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();
}

View file

@ -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);

View file

@ -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);