This commit is contained in:
Victor Shcherb 2018-05-11 01:17:34 +02:00
parent e56847043c
commit d1e219da4a
2 changed files with 10 additions and 15 deletions

View file

@ -604,11 +604,6 @@ public class FavouritesDbHelper {
if (name == null) { if (name == null) {
name = ""; 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); FavouritePoint fp = new FavouritePoint(p.lat, p.lon, name, categoryName);
fp.setDescription(p.desc); fp.setDescription(p.desc);
if (p.comment != null) { if (p.comment != null) {

View file

@ -41,19 +41,19 @@ public class FavoritePointEditor extends PointEditor {
} }
public void add(LatLon latLon, String title, String originObjectName, String categoryName, int categoryColor, boolean autoFill) { public void add(LatLon latLon, String title, String originObjectName, String categoryName, int categoryColor, boolean autoFill) {
if (latLon == null) {
if (latLon == null) return; return;
}
isNew = true; isNew = true;
if (categoryName != null && !categoryName.isEmpty()) { if (categoryName != null && !categoryName.isEmpty()) {
FavouritesDbHelper.FavoriteGroup category = mapActivity.getMyApplication().getFavorites()
FavouritesDbHelper.FavoriteGroup category = mapActivity.getMyApplication().getFavorites().getGroup(categoryName); .getGroup(categoryName);
if (category == null) {
if (category == null)
mapActivity.getMyApplication().getFavorites().addEmptyCategory(categoryName, categoryColor); mapActivity.getMyApplication().getFavorites().addEmptyCategory(categoryName, categoryColor);
}
} else categoryName = ""; } else {
categoryName = "";
}
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, categoryName); favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, categoryName);
favorite.setDescription(""); favorite.setDescription("");