Remove the ability to add groups with the same name

This commit is contained in:
Alexander Sytnyk 2017-07-05 18:55:15 +03:00
parent 6cd6e7ea63
commit f6aeaed8d1

View file

@ -358,6 +358,12 @@ public class OsmandAidlApi {
boolean addFavoriteGroup(AFavoriteGroup favoriteGroup) { boolean addFavoriteGroup(AFavoriteGroup favoriteGroup) {
if (favoriteGroup != null) { if (favoriteGroup != null) {
FavouritesDbHelper favoritesHelper = app.getFavorites(); FavouritesDbHelper favoritesHelper = app.getFavorites();
List<FavouritesDbHelper.FavoriteGroup> groups = favoritesHelper.getFavoriteGroups();
for (FavouritesDbHelper.FavoriteGroup g : groups) {
if (g.name.equals(favoriteGroup.getName())) {
return false;
}
}
int color = 0; int color = 0;
if (!Algorithms.isEmpty(favoriteGroup.getColor())) { if (!Algorithms.isEmpty(favoriteGroup.getColor())) {
color = ColorDialogs.getColorByTag(favoriteGroup.getColor()); color = ColorDialogs.getColorByTag(favoriteGroup.getColor());