This commit is contained in:
Alexey Kulish 2016-07-03 12:59:29 +03:00
parent 187cdd1928
commit f6f25e6c9f
2 changed files with 7 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu.editors;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.plus.activities.MapActivity;
import net.osmand.util.Algorithms;
public class FavoritePointEditor extends PointEditor {
@ -28,8 +29,11 @@ public class FavoritePointEditor extends PointEditor {
return;
}
isNew = true;
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title,
app.getSettings().LAST_FAV_CATEGORY_ENTERED.get());
String lastCategory = app.getSettings().LAST_FAV_CATEGORY_ENTERED.get();
if (!Algorithms.isEmpty(lastCategory) && !app.getFavorites().groupExists(lastCategory)) {
lastCategory = "";
}
favorite = new FavouritePoint(latLon.getLatitude(), latLon.getLongitude(), title, lastCategory);
favorite.setDescription("");
FavoritePointEditorFragment.showInstance(mapActivity);
}

View file

@ -161,6 +161,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
favorite.setName(name);
favorite.setCategory(category);
favorite.setDescription(description);
getMyApplication().getSettings().LAST_FAV_CATEGORY_ENTERED.set(category);
helper.addFavourite(favorite);
}