From f6aeaed8d15658e880876b972b0163d635ba43b3 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 5 Jul 2017 18:55:15 +0300 Subject: [PATCH] Remove the ability to add groups with the same name --- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 02b1e1e30b..351e511ea5 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -358,6 +358,12 @@ public class OsmandAidlApi { boolean addFavoriteGroup(AFavoriteGroup favoriteGroup) { if (favoriteGroup != null) { FavouritesDbHelper favoritesHelper = app.getFavorites(); + List groups = favoritesHelper.getFavoriteGroups(); + for (FavouritesDbHelper.FavoriteGroup g : groups) { + if (g.name.equals(favoriteGroup.getName())) { + return false; + } + } int color = 0; if (!Algorithms.isEmpty(favoriteGroup.getColor())) { color = ColorDialogs.getColorByTag(favoriteGroup.getColor());