Trim favorite name

This commit is contained in:
Victor Shcherb 2013-08-03 23:52:17 +02:00
parent 4b5cf87d34
commit 5feaaa8485
2 changed files with 3 additions and 3 deletions

View file

@ -241,7 +241,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
builder.setPositiveButton(R.string.default_buttons_apply, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.default_buttons_apply, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
boolean editied = helper.editFavouriteName(point, editText.getText().toString(), cat.getText().toString()); boolean editied = helper.editFavouriteName(point, editText.getText().toString().trim(), cat.getText().toString());
if (editied) { if (editied) {
favouritesAdapter.synchronizeGroups(); favouritesAdapter.synchronizeGroups();
favouritesAdapter.sort(favoritesComparator); favouritesAdapter.sort(favoritesComparator);

View file

@ -180,8 +180,8 @@ public class MapActivityActions implements DialogProvider {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE); FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE);
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites(); final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
point.setName(editText.getText().toString()); point.setName(editText.getText().toString().trim());
point.setCategory(cat.getText().toString()); point.setCategory(cat.getText().toString().trim());
boolean added = helper.addFavourite(point); boolean added = helper.addFavourite(point);
if (added) { if (added) {
AccessibleToast.makeText(activity, MessageFormat.format( AccessibleToast.makeText(activity, MessageFormat.format(