use of net.osmand.plus.R in project Osmand by osmandapp.
the class OsmBugsLayer method getHandleBugListener.
HandleBugListener getHandleBugListener(@NonNull MapActivity mapActivity) {
return (obj, action, bug, point, text) -> {
if (mapActivity.isFinishing()) {
return;
}
if (obj != null && obj.warning == null) {
if (local == getOsmBugsUtil(bug)) {
Toast.makeText(ctx, R.string.osm_changes_added_to_local_edits, Toast.LENGTH_LONG).show();
if (obj.local != null) {
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_OSM_BUG, obj.local.getText());
mapActivity.getContextMenu().show(new LatLon(obj.local.getLatitude(), obj.local.getLongitude()), pd, obj.local);
mapActivity.getMapLayers().getContextMenuLayer().updateContextMenu();
}
} else {
if (action == Action.REOPEN) {
Toast.makeText(ctx, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
} else if (action == Action.MODIFY) {
Toast.makeText(ctx, R.string.osb_comment_dialog_success, Toast.LENGTH_LONG).show();
} else if (action == Action.DELETE) {
Toast.makeText(ctx, R.string.osn_close_dialog_success, Toast.LENGTH_LONG).show();
} else if (action == Action.CREATE) {
Toast.makeText(ctx, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
}
}
clearCache();
} else {
int r = R.string.osb_comment_dialog_error;
if (action == Action.REOPEN) {
r = R.string.osn_add_dialog_error;
reopenBug(mapActivity, bug, text);
} else if (action == Action.DELETE) {
r = R.string.osn_close_dialog_error;
closeBug(mapActivity, bug, text);
} else if (action == Action.CREATE) {
r = R.string.osn_add_dialog_error;
openBug(mapActivity, bug.getLatitude(), bug.getLongitude(), text, false);
} else if (action == null) {
r = R.string.osn_modify_dialog_error;
modifyBug(mapActivity, point);
} else {
commentBug(mapActivity, bug, text);
}
Toast.makeText(ctx, ctx.getResources().getString(r) + "\n" + obj, Toast.LENGTH_LONG).show();
}
};
}
Aggregations