From d1e219da4a561410e3818264c842ebf14ea697c8 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 11 May 2018 01:17:34 +0200 Subject: [PATCH] Fix #5151 --- .../net/osmand/plus/FavouritesDbHelper.java | 5 ----- .../editors/FavoritePointEditor.java | 20 +++++++++---------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java index e6eb2e1edb..f8b4d168f6 100644 --- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java @@ -604,11 +604,6 @@ public class FavouritesDbHelper { if (name == null) { name = ""; } - // old way to store the category, in name. - if ("".equals(categoryName.trim()) && (c = name.lastIndexOf('_')) != -1) { - categoryName = name.substring(c + 1); - name = name.substring(0, c); - } FavouritePoint fp = new FavouritePoint(p.lat, p.lon, name, categoryName); fp.setDescription(p.desc); if (p.comment != null) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java index 0076e00c49..755c9ab453 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditor.java @@ -41,19 +41,19 @@ public class FavoritePointEditor extends PointEditor { } public void add(LatLon latLon, String title, String originObjectName, String categoryName, int categoryColor, boolean autoFill) { - - if (latLon == null) return; - + if (latLon == null) { + return; + } isNew = true; - if (categoryName != null && !categoryName.isEmpty()) { - - FavouritesDbHelper.FavoriteGroup category = mapActivity.getMyApplication().getFavorites().getGroup(categoryName); - - if (category == null) + FavouritesDbHelper.FavoriteGroup category = mapActivity.getMyApplication().getFavorites() + .getGroup(categoryName); + if (category == null) { mapActivity.getMyApplication().getFavorites().addEmptyCategory(categoryName, categoryColor); - - } else categoryName = ""; + } + } else { + categoryName = ""; + } favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, categoryName); favorite.setDescription("");