public static void showInstance(final MapActivity mapActivity) { FavoritePointEditor editor = mapActivity.getContextMenu().getFavoritePointEditor(); // int slideInAnim = editor.getSlideInAnimation(); // int slideOutAnim = editor.getSlideOutAnimation(); FavoritePointEditorFragment fragment = new FavoritePointEditorFragment(); mapActivity .getSupportFragmentManager() .beginTransaction() // .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim) .add(R.id.fragmentContainer, fragment, editor.getFragmentTag()) .addToBackStack(null) .commit(); }
@Override public String getToolbarTitle() { if (editor.isNew()) { return getMapActivity().getResources().getString(R.string.favourites_context_menu_add); } else { return getMapActivity().getResources().getString(R.string.favourites_context_menu_edit); } }
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); defaultColor = getResources().getColor(R.color.color_favorite); favorite = editor.getFavorite(); 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; }
private void doSave( FavouritePoint favorite, String name, String category, String description, boolean needDismiss) { if (editor.isNew()) { doAddFavorite(name, category, description); } else { helper.editFavouriteName(favorite, name, category, description); } getMapActivity().refreshMap(); if (needDismiss) { dismiss(false); } MapContextMenu menu = getMapActivity().getContextMenu(); LatLon latLon = new LatLon(favorite.getLatitude(), favorite.getLongitude()); if (menu.getLatLon().equals(latLon)) { menu.update(latLon, favorite.getPointDescription(), favorite); } }