use of net.osmand.aidl.favorite.group.AFavoriteGroup in project Osmand by osmandapp.
the class OsmandAidlApi method addFavoriteGroup.
boolean addFavoriteGroup(AFavoriteGroup favoriteGroup) {
if (favoriteGroup != null) {
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;
if (!Algorithms.isEmpty(favoriteGroup.getColor())) {
color = ColorDialogs.getColorByTag(favoriteGroup.getColor());
}
favoritesHelper.addEmptyCategory(favoriteGroup.getName(), color, favoriteGroup.isVisible());
return true;
} else {
return false;
}
}
use of net.osmand.aidl.favorite.group.AFavoriteGroup in project Osmand by osmandapp.
the class OsmandAidlApi method updateFavoriteGroup.
boolean updateFavoriteGroup(AFavoriteGroup gPrev, AFavoriteGroup gNew) {
if (gPrev != null && gNew != null) {
FavouritesDbHelper favoritesHelper = app.getFavorites();
List<FavouritesDbHelper.FavoriteGroup> groups = favoritesHelper.getFavoriteGroups();
for (FavouritesDbHelper.FavoriteGroup g : groups) {
if (g.name.equals(gPrev.getName())) {
int color = 0;
if (!Algorithms.isEmpty(gNew.getColor())) {
color = ColorDialogs.getColorByTag(gNew.getColor());
}
favoritesHelper.editFavouriteGroup(g, gNew.getName(), color, gNew.isVisible());
return true;
}
}
return false;
} else {
return false;
}
}
use of net.osmand.aidl.favorite.group.AFavoriteGroup in project Osmand by osmandapp.
the class OsmandAidlApi method removeFavoriteGroup.
boolean removeFavoriteGroup(AFavoriteGroup favoriteGroup) {
if (favoriteGroup != null) {
FavouritesDbHelper favoritesHelper = app.getFavorites();
List<FavouritesDbHelper.FavoriteGroup> groups = favoritesHelper.getFavoriteGroups();
for (FavouritesDbHelper.FavoriteGroup g : groups) {
if (g.name.equals(favoriteGroup.getName())) {
favoritesHelper.deleteGroup(g);
return true;
}
}
return false;
} else {
return false;
}
}
Aggregations