From 987e45a0dad4679876b5abed1373378146e2303f Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 13 Oct 2017 14:47:38 +0300 Subject: [PATCH] Fix #4564 --- .../plus/osmedit/EditPoiDialogFragment.java | 18 ++++++++++++++++++ .../osmand/plus/osmedit/OsmEditsFragment.java | 13 ++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 188915c41e..165c37ab4d 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -93,6 +93,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { BASIC_TAGS.add(OSMSettings.OSMTagKey.OPENING_HOURS.getValue()); } + private OnPoiChangedListener onPoiChangedListener; + private EditPoiData editPoiData; private ViewPager viewPager; private AutoCompleteTextView poiTypeEditText; @@ -101,6 +103,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { private TextInputLayout poiTypeTextInputLayout; private View view; + public void setOnPoiChangedListener(OnPoiChangedListener listener) { + this.onPoiChangedListener = listener; + } + @Override public void onAttach(Activity activity) { super.onAttach(activity); @@ -473,6 +479,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { if (getActivity() instanceof MapActivity) { ((MapActivity) getActivity()).getMapView().refreshMap(true); } + if (onPoiChangedListener != null) { + onPoiChangedListener.onPoiChanged(); + } dismiss(); } else { OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); @@ -618,11 +627,16 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { } public static EditPoiDialogFragment createInstance(Node node, boolean isAddingPoi) { + return createInstance(node, isAddingPoi, (OnPoiChangedListener) null); + } + + public static EditPoiDialogFragment createInstance(Node node, boolean isAddingPoi, OnPoiChangedListener listener) { EditPoiDialogFragment editPoiDialogFragment = new EditPoiDialogFragment(); Bundle args = new Bundle(); args.putSerializable(KEY_AMENITY_NODE, node); args.putBoolean(IS_ADDING_POI, isAddingPoi); editPoiDialogFragment.setArguments(args); + editPoiDialogFragment.setOnPoiChangedListener(listener); return editPoiDialogFragment; } @@ -835,4 +849,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { public interface OnFragmentActivatedListener { void onFragmentActivated(); } + + public interface OnPoiChangedListener { + void onPoiChanged(); + } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index cd221f2e5f..2eeca24776 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -323,6 +323,10 @@ public class OsmEditsFragment extends OsmAndListFragment @Override public void onResume() { super.onResume(); + fetchData(); + } + + private void fetchData() { ArrayList dataPoints = new ArrayList<>(); List l1 = plugin.getDBPOI().getOpenstreetmapPoints(); List l2 = plugin.getDBBug().getOsmbugsPoints(); @@ -351,7 +355,6 @@ public class OsmEditsFragment extends OsmAndListFragment } else { listAdapter.setNewList(dataPoints); } - } private void showBugDialog(final OsmNotesPoint point) { @@ -527,8 +530,12 @@ public class OsmEditsFragment extends OsmAndListFragment OpenstreetmapPoint i = (OpenstreetmapPoint) getPointAfterModify(info); final Node entity = i.getEntity(); refreshId = entity.getId(); - EditPoiDialogFragment.createInstance(entity, false) - .show(getActivity().getSupportFragmentManager(), "edit_poi"); + EditPoiDialogFragment.createInstance(entity, false, new EditPoiDialogFragment.OnPoiChangedListener() { + @Override + public void onPoiChanged() { + fetchData(); + } + }).show(getActivity().getSupportFragmentManager(), "edit_poi"); return true; } });