diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 8c53c8a179..0dc90f01fd 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Created OSM POI + Created OSM bug World basemap (covering the whole world at small zooms) is missing or outdated. Please consider downloading World basemap for a complete environment. QR-code Map downloaded diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 7b027e6f51..fc62c99df9 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -14,6 +14,7 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording; import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController; +import net.osmand.plus.mapcontextmenu.controllers.EditPOIMenuController; import net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController; import net.osmand.plus.mapcontextmenu.controllers.HistoryMenuController; import net.osmand.plus.mapcontextmenu.controllers.MyLocationMenuController; @@ -22,6 +23,7 @@ import net.osmand.plus.mapcontextmenu.controllers.ParkingPositionMenuController; import net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController; import net.osmand.plus.mapcontextmenu.controllers.AudioVideoNoteMenuController; import net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController; +import net.osmand.plus.osmedit.OsmPoint; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice; public abstract class MenuController extends BaseMenuController { @@ -94,6 +96,8 @@ public abstract class MenuController extends BaseMenuController { menuController = new OsMoMenuController(app, mapActivity, (OsMoDevice) object); } else if (object instanceof Recording) { menuController = new AudioVideoNoteMenuController(app, mapActivity, (Recording) object); + } else if (object instanceof OsmPoint) { + menuController = new EditPOIMenuController(app, mapActivity, pointDescription, (OsmPoint) object); } else if (object instanceof LatLon) { if (pointDescription.isParking()) { menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java index ab949c609f..63ad15723e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java @@ -99,6 +99,11 @@ public abstract class MenuTitleController { } protected void acquireNameAndType() { + nameStr = ""; + typeStr = ""; + streetStr = ""; + addressUnknown = false; + MenuController menuController = getMenuController(); PointDescription pointDescription = getPointDescription(); if (menuController != null) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/EditPOIMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/EditPOIMenuBuilder.java new file mode 100644 index 0000000000..f68add74c5 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/EditPOIMenuBuilder.java @@ -0,0 +1,191 @@ +package net.osmand.plus.mapcontextmenu.builders; + +import android.graphics.drawable.Drawable; +import android.text.TextUtils; +import android.text.util.Linkify; +import android.view.Gravity; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import net.osmand.data.Amenity; +import net.osmand.osm.AbstractPoiType; +import net.osmand.osm.MapPoiTypes; +import net.osmand.osm.PoiType; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.osmedit.OpenstreetmapPoint; +import net.osmand.plus.osmedit.OsmEditingPlugin; +import net.osmand.plus.osmedit.OsmNotesPoint; +import net.osmand.plus.osmedit.OsmPoint; +import net.osmand.util.Algorithms; + +import java.util.Map; + +public class EditPOIMenuBuilder extends MenuBuilder { + + private final OsmPoint osmPoint; + + public EditPOIMenuBuilder(OsmandApplication app, final OsmPoint osmPoint) { + super(app); + this.osmPoint = osmPoint; + } + + private void buildRow(View view, int iconId, String text, int textColor, boolean needLinks) { + buildRow(view, getRowIcon(iconId), text, textColor, needLinks); + } + + protected void buildRow(final View view, Drawable icon, String text, int textColor, boolean needLinks) { + boolean light = app.getSettings().isLightContent(); + + LinearLayout ll = new LinearLayout(view.getContext()); + ll.setOrientation(LinearLayout.HORIZONTAL); + LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + ll.setLayoutParams(llParams); + + // Icon + LinearLayout llIcon = new LinearLayout(view.getContext()); + llIcon.setOrientation(LinearLayout.HORIZONTAL); + llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), isFirstRow() ? dpToPx(48f) - dpToPx(SHADOW_HEIGHT_BOTTOM_DP) : dpToPx(48f))); + llIcon.setGravity(Gravity.CENTER_VERTICAL); + ll.addView(llIcon); + + ImageView iconView = new ImageView(view.getContext()); + LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + llIconParams.setMargins(dpToPx(16f), isFirstRow() ? dpToPx(12f) - dpToPx(SHADOW_HEIGHT_BOTTOM_DP / 2f) : dpToPx(12f), dpToPx(32f), dpToPx(12f)); + llIconParams.gravity = Gravity.CENTER_VERTICAL; + iconView.setLayoutParams(llIconParams); + iconView.setScaleType(ImageView.ScaleType.CENTER); + iconView.setImageDrawable(icon); + llIcon.addView(iconView); + + // Text + LinearLayout llText = new LinearLayout(view.getContext()); + llText.setOrientation(LinearLayout.VERTICAL); + ll.addView(llText); + + TextView textView = new TextView(view.getContext()); + LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + llTextParams.setMargins(0, isFirstRow() ? dpToPx(8f) - dpToPx(SHADOW_HEIGHT_BOTTOM_DP) : dpToPx(8f), 0, dpToPx(8f)); + textView.setLayoutParams(llTextParams); + textView.setTextSize(16); + textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark)); + + if (needLinks) { + textView.setAutoLinkMask(Linkify.ALL); + textView.setLinksClickable(true); + } + textView.setEllipsize(TextUtils.TruncateAt.END); + textView.setText(text); + if (textColor > 0) { + textView.setTextColor(view.getResources().getColor(textColor)); + } + + LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + llTextViewParams.setMargins(0, 0, dpToPx(10f), 0); + llTextViewParams.gravity = Gravity.CENTER_VERTICAL; + llText.setLayoutParams(llTextViewParams); + llText.addView(textView); + + ((LinearLayout) view).addView(ll); + + View horizontalLine = new View(view.getContext()); + LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f)); + llHorLineParams.gravity = Gravity.BOTTOM; + horizontalLine.setLayoutParams(llHorLineParams); + + horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_info_divider_light : R.color.ctx_menu_info_divider_dark)); + + ((LinearLayout) view).addView(horizontalLine); + + rowBuilt(); + } + + @Override + public void build(View view) { + super.build(view); + + if (osmPoint instanceof OsmNotesPoint) { + OsmNotesPoint notes = (OsmNotesPoint) osmPoint; + + buildRow(view, R.drawable.ic_action_note_dark, notes.getText(), 0, false); + buildRow(view, R.drawable.ic_group, notes.getAuthor(), 0, false); + + } else if (osmPoint instanceof OpenstreetmapPoint) { + OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint; + + MapPoiTypes poiTypes = app.getPoiTypes(); + + for (Map.Entry e : point.getEntity().getTags().entrySet()) { + int iconId; + Drawable icon = null; + int textColor = 0; + String key = e.getKey(); + String vl = e.getValue(); + + boolean needLinks = !"population".equals(key); + + if (key.startsWith("name:")) { + continue; + } else if (Amenity.OPENING_HOURS.equals(key)) { + iconId = R.drawable.ic_action_time; + } else if (Amenity.PHONE.equals(key)) { + iconId = R.drawable.ic_action_call_dark; + } else if (Amenity.WEBSITE.equals(key)) { + iconId = R.drawable.ic_world_globe_dark; + vl = vl.replace(' ', '_'); + } else { + if (Amenity.DESCRIPTION.equals(key)) { + iconId = R.drawable.ic_action_note_dark; + } else { + iconId = R.drawable.ic_action_info_dark; + } + AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(key); + if (pt != null) { + PoiType pType = (PoiType) pt; + if (pType.getParentType() != null && pType.getParentType() instanceof PoiType) { + icon = getRowIcon(view.getContext(), ((PoiType) pType.getParentType()).getOsmTag() + "_" + pType.getOsmTag().replace(':', '_') + "_" + pType.getOsmValue()); + } + if (!((PoiType) pt).isText()) { + vl = pt.getTranslation(); + } else { + vl = pt.getTranslation() + ": " + e.getValue(); + } + } else { + vl = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) + ": " + e.getValue(); + } + } + + if (icon != null) { + buildRow(view, icon, vl, textColor, needLinks); + } else { + buildRow(view, iconId, vl, textColor, needLinks); + } + } + } + + buildButtonRow(view, null, view.getResources().getString(R.string.shared_string_delete), new OnClickListener() { + @Override + public void onClick(View v) { + OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); + if (plugin != null) { + boolean deleted = false; + if (osmPoint instanceof OsmNotesPoint) { + deleted = plugin.getDBBug().deleteAllBugModifications((OsmNotesPoint) osmPoint); + } else if (osmPoint instanceof OpenstreetmapPoint) { + deleted = plugin.getDBPOI().deletePOI((OpenstreetmapPoint) osmPoint); + } + if (deleted && v.getContext() instanceof MapActivity) { + ((MapActivity)v.getContext()).getContextMenu().close(); + } + } + } + }); + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/EditPOIMenuController.java new file mode 100644 index 0000000000..e436b013b0 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/EditPOIMenuController.java @@ -0,0 +1,119 @@ +package net.osmand.plus.mapcontextmenu.controllers; + +import android.app.ProgressDialog; +import android.graphics.drawable.Drawable; + +import net.osmand.data.PointDescription; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.ProgressImplementation; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.mapcontextmenu.MenuController; +import net.osmand.plus.mapcontextmenu.builders.EditPOIMenuBuilder; +import net.osmand.plus.osmedit.OpenstreetmapRemoteUtil; +import net.osmand.plus.osmedit.OsmBugsRemoteUtil; +import net.osmand.plus.osmedit.OsmEditingPlugin; +import net.osmand.plus.osmedit.OsmEditsUploadListener; +import net.osmand.plus.osmedit.OsmEditsUploadListenerHelper; +import net.osmand.plus.osmedit.OsmPoint; +import net.osmand.plus.osmedit.UploadOpenstreetmapPointAsyncTask; +import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment; +import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment.ProgressDialogPoiUploader; +import net.osmand.util.Algorithms; + +import java.util.Map; + +public class EditPOIMenuController extends MenuController { + + private PointDescription pointDescription; + private OsmEditingPlugin plugin; + private String pointTypeStr; + private ProgressDialogPoiUploader poiUploader; + + public EditPOIMenuController(OsmandApplication app, final MapActivity mapActivity, final PointDescription pointDescription, final OsmPoint osmPoint) { + super(new EditPOIMenuBuilder(app, osmPoint), mapActivity); + this.pointDescription = pointDescription; + plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); + + poiUploader = new ProgressDialogPoiUploader() { + @Override + public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet) { + ProgressDialog dialog = ProgressImplementation.createProgressDialog( + getMapActivity(), + getMapActivity().getString(R.string.uploading), + getMapActivity().getString(R.string.local_openstreetmap_uploading), + ProgressDialog.STYLE_HORIZONTAL).getDialog(); + OsmEditsUploadListener listener = new OsmEditsUploadListenerHelper(getMapActivity(), + getMapActivity().getString(R.string.local_openstreetmap_were_uploaded)) { + @Override + public void uploadEnded(Map loadErrorsMap) { + super.uploadEnded(loadErrorsMap); + for (OsmPoint osmPoint : loadErrorsMap.keySet()) { + if (loadErrorsMap.get(osmPoint) == null) { + getMapActivity().getContextMenu().close(); + } + } + } + }; + OpenstreetmapRemoteUtil remotepoi = new OpenstreetmapRemoteUtil(getMapActivity()); + OsmBugsRemoteUtil remotebug = new OsmBugsRemoteUtil(getMapActivity().getMyApplication()); + UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( + dialog, listener, plugin, remotepoi, remotebug, points.length, closeChangeSet); + uploadTask.execute(points); + + dialog.show(); + } + }; + + titleButtonController = new TitleButtonController() { + @Override + public void buttonPressed() { + if (plugin != null) { + SendPoiDialogFragment sendPoiDialogFragment = SendPoiDialogFragment.createInstance(new OsmPoint[]{osmPoint}); + sendPoiDialogFragment.setPoiUploader(poiUploader); + sendPoiDialogFragment.show(mapActivity.getSupportFragmentManager(), SendPoiDialogFragment.TAG); + } + } + }; + titleButtonController.caption = getMapActivity().getString(R.string.local_openstreetmap_upload); + + if (osmPoint.getGroup() == OsmPoint.Group.POI) { + pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_poi); + } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { + pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_bug); + } else { + pointTypeStr = ""; + } + } + + @Override + protected int getSupportedMenuStatesPortrait() { + return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN; + } + + @Override + public boolean needTypeStr() { + return !Algorithms.isEmpty(pointTypeStr); + } + + @Override + public Drawable getLeftIcon() { + return getIcon(R.drawable.ic_action_gabout_dark, R.color.osmand_orange_dark, R.color.osmand_orange); + } + + @Override + public String getNameStr() { + return pointDescription.getSimpleName(getMapActivity(), false); + } + + @Override + public String getTypeStr() { + return pointTypeStr; + } + + @Override + public boolean needStreetName() { + return false; + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ParkingPositionMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ParkingPositionMenuController.java index 904bf9b913..f5ac0789f8 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ParkingPositionMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ParkingPositionMenuController.java @@ -15,8 +15,8 @@ import net.osmand.util.Algorithms; public class ParkingPositionMenuController extends MenuController { private PointDescription pointDescription; - ParkingPositionPlugin plugin; - String parkingDescription = ""; + private ParkingPositionPlugin plugin; + private String parkingDescription = ""; public ParkingPositionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) { super(new MenuBuilder(app), mapActivity); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java index 3ab9b0b6c9..48aff6acf5 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/PointDescriptionMenuController.java @@ -9,6 +9,7 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.search.SearchHistoryFragment; import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; +import net.osmand.util.Algorithms; public class PointDescriptionMenuController extends MenuController { @@ -27,7 +28,7 @@ public class PointDescriptionMenuController extends MenuController { @Override public boolean needTypeStr() { String typeName = pointDescription.getTypeName(); - return (typeName != null && !typeName.isEmpty()); + return (typeName != null && !Algorithms.isEmpty(typeName)); } @Override diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 356d79d575..54b1032982 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -46,6 +46,7 @@ import android.widget.Toast; import net.osmand.PlatformUtil; import net.osmand.access.AccessibleToast; import net.osmand.data.Amenity; +import net.osmand.data.LatLon; import net.osmand.osm.PoiType; import net.osmand.osm.edit.EntityInfo; import net.osmand.osm.edit.Node; @@ -66,6 +67,7 @@ import org.apache.commons.logging.Log; import java.io.Serializable; import java.text.MessageFormat; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; public class EditPoiDialogFragment extends DialogFragment { @@ -327,6 +329,18 @@ public class EditPoiDialogFragment extends DialogFragment { R.string.poi_action_succeded_template), message), Toast.LENGTH_LONG).show(); } + + OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); + if (plugin != null) { + List points = plugin.getDBPOI().getOpenstreetmapPoints(); + OsmPoint point = points.get(points.size() - 1); + if (getActivity() instanceof MapActivity) { + MapActivity mapActivity = (MapActivity) getActivity(); + mapActivity.getContextMenu().showOrUpdate(new LatLon(point.getLatitude(), point.getLongitude()), + plugin.getOsmEditsLayer(mapActivity).getObjectName(point), point); + } + } + if (getActivity() instanceof MapActivity) { ((MapActivity) getActivity()).getMapView().refreshMap(true); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index acabaa7ccd..42899ab96b 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -357,6 +357,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider } else { AccessibleToast.makeText(activity, R.string.osb_add_dialog_success, Toast.LENGTH_LONG).show(); } + List points = plugin.getDBBug().getOsmbugsPoints(); + OsmPoint point = points.get(points.size() - 1); + activity.getContextMenu().showOrUpdate(new LatLon(latitude, longitude), plugin.getOsmEditsLayer(activity).getObjectName(point), point); refreshMap(); } else { AccessibleToast.makeText(activity, activity.getResources().getString(R.string.osb_add_dialog_error) + "\n" + result, diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 62c40931d9..88a0bb7932 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -162,28 +162,6 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC } return null; } - - @Override - public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) { - if (o instanceof OsmPoint) { - final OsmPoint r = (OsmPoint) o; - adapter.item(R.string.osm_edit_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark - ).listen(new ContextMenuAdapter.OnContextMenuClick() { - @Override - public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked) { - if(r instanceof OsmNotesPoint) { - plugin.getDBBug().deleteAllBugModifications((OsmNotesPoint) r); - } else if(r instanceof OpenstreetmapPoint) { - plugin.getDBPOI().deletePOI((OpenstreetmapPoint) r); - } - view.refreshMap(); - return true; - } - - - }).reg(); - } - } @Override public String getObjectDescription(Object o) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java index aa923c3103..b56690f40a 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java @@ -20,6 +20,11 @@ public class SendPoiDialogFragment extends DialogFragment { public static final String TAG = "SendPoiDialogFragment"; public static final String OPENSTREETMAP_POINT = "openstreetmap_point"; private static String comment; + private ProgressDialogPoiUploader poiUploader; + + public void setPoiUploader(ProgressDialogPoiUploader poiUploader) { + this.poiUploader = poiUploader; + } @NonNull @Override @@ -38,8 +43,12 @@ public class SendPoiDialogFragment extends DialogFragment { userNameEditText.setText(settings.USER_NAME.get()); passwordEditText.setText(settings.USER_PASSWORD.get()); - final ProgressDialogPoiUploader progressDialogPoiUploader = - (ProgressDialogPoiUploader) getParentFragment(); + final ProgressDialogPoiUploader progressDialogPoiUploader; + if (poiUploader != null) { + progressDialogPoiUploader = poiUploader; + } else { + progressDialogPoiUploader = (ProgressDialogPoiUploader) getParentFragment(); + } builder.setTitle(R.string.commit_poi) .setView(view)