diff --git a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java index ad0a5b0887..72f89f8fce 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java @@ -22,6 +22,7 @@ import android.widget.Toast; import net.osmand.AndroidUtils; import net.osmand.access.AccessibleToast; import net.osmand.data.FavouritePoint; +import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; @@ -57,8 +58,10 @@ public class FavoriteDialogs { } FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE); if (helper.editFavourite(fp, point.getLatitude(), point.getLongitude())) { - AccessibleToast.makeText(activity, activity.getString(R.string.fav_points_edited), - Toast.LENGTH_SHORT).show(); + if (activity instanceof MapActivity) { + ((MapActivity) activity).getContextMenu() + .show(new LatLon(point.getLatitude(), point.getLongitude()), fp.getPointDescription(), fp); + } } if (activity instanceof MapActivity) { ((MapActivity) activity).getMapView().refreshMap(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java index 5cf18edfe4..ca39232110 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java @@ -7,6 +7,10 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; @@ -17,6 +21,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.FavoriteImageDrawable; +import net.osmand.plus.dialogs.FavoriteDialogs; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.util.Algorithms; @@ -38,7 +43,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment { } @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean light = getMyApplication().getSettings().isLightContent(); @@ -48,6 +53,24 @@ public class FavoritePointEditorFragment extends PointEditorFragment { group = helper.getGroup(favorite); } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = super.onCreateView(inflater, container, savedInstanceState); + if (view != null && editor.isNew()) { + Button btnReplace = (Button) view.findViewById(R.id.button_replace); + btnReplace.setVisibility(View.VISIBLE); + btnReplace.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Bundle args = new Bundle(); + args.putSerializable(FavoriteDialogs.KEY_FAVORITE, favorite); + FavoriteDialogs.createReplaceFavouriteDialog(getActivity(), args); + } + }); + } + return view; + } + @Override public PointEditor getEditor() { return editor;