This commit is contained in:
PavelRatushny 2017-10-13 14:47:38 +03:00
parent f1a656efba
commit 987e45a0da
2 changed files with 28 additions and 3 deletions

View file

@ -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();
}
}

View file

@ -323,6 +323,10 @@ public class OsmEditsFragment extends OsmAndListFragment
@Override
public void onResume() {
super.onResume();
fetchData();
}
private void fetchData() {
ArrayList<OsmPoint> dataPoints = new ArrayList<>();
List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints();
List<OsmNotesPoint> 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;
}
});