Fix small issue with poi edits

This commit is contained in:
Victor Shcherb 2015-11-15 21:17:13 +01:00
parent 2d4a19c24c
commit 2f66485e4f
7 changed files with 25 additions and 8 deletions

View file

@ -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
-->
<string name="osm_edit_modified_poi">Modified OSM POI</string>
<string name="osm_edit_deleted_poi">Deleted OSM POI</string>
<string name="context_menu_item_open_note">Open OSM Note</string>
<string name="osm_edit_reopened_note">Reopened OSM Note</string>
<string name="osm_edit_commented_note">Commented OSM Note</string>

View file

@ -116,7 +116,14 @@ public class EditPOIMenuController extends MenuController {
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_poi);
if(osmPoint.getAction() == Action.DELETE) {
pointTypeStr = getMapActivity().getString(R.string.osm_edit_deleted_poi);
} else if(osmPoint.getAction() == Action.MODIFY) {
pointTypeStr = getMapActivity().getString(R.string.osm_edit_modified_poi);
} else/* if(osmPoint.getAction() == Action.CREATE) */{
pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_poi);
}
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
if(osmPoint.getAction() == Action.DELETE) {
pointTypeStr = getMapActivity().getString(R.string.osm_edit_removed_note);

View file

@ -633,7 +633,7 @@ public class EditPoiDialogFragment extends DialogFragment {
builder.setView(ll);
}
builder.setNegativeButton(R.string.shared_string_cancel, null);
builder.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() {
builder.setPositiveButton(isLocalEdit ? R.string.shared_string_save : R.string.shared_string_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String c = comment == null ? null : comment.getText().toString();

View file

@ -1,13 +1,13 @@
package net.osmand.plus.osmedit;
import android.content.Context;
import net.osmand.PlatformUtil;
import net.osmand.data.Amenity;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.EntityInfo;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.OSMSettings.OSMTagKey;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
@ -65,8 +65,12 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
if(poiType.getOsmTag2() != null) {
entity.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
}
entity.putTag(OSMTagKey.NAME.getValue(), n.getName());
entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours());
if(!Algorithms.isEmpty(n.getName())) {
entity.putTag(OSMTagKey.NAME.getValue(), n.getName());
}
if(!Algorithms.isEmpty(n.getOpeningHours())) {
entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours());
}
// check whether this is node (because id of node could be the same as relation)
if(entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50){

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map.Entry;
import net.osmand.osm.edit.Node;
import net.osmand.util.Algorithms;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@ -60,6 +61,9 @@ public class OpenstreetmapsDbHelper extends SQLiteOpenHelper {
Iterator<Entry<String, String>> eit = p.getEntity().getTags().entrySet().iterator();
while(eit.hasNext()) {
Entry<String, String> e = eit.next();
if(Algorithms.isEmpty(e.getKey()) || Algorithms.isEmpty(e.getValue())) {
continue;
}
tags.append(e.getKey()).append("$$$").append(e.getValue());
if(eit.hasNext()) {
tags.append("$$$");

View file

@ -27,7 +27,6 @@ import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.access.AccessibleToast;
import net.osmand.data.PointDescription;
import net.osmand.osm.edit.Node;
@ -43,6 +42,7 @@ import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.osmedit.OsmPoint.Action;
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
import org.xmlpull.v1.XmlSerializer;
@ -467,7 +467,7 @@ public class OsmEditsFragment extends OsmAndListFragment
return true;
}
});
if (info instanceof OpenstreetmapPoint) {
if (info instanceof OpenstreetmapPoint && info.getAction() != Action.DELETE) {
item = optionsMenu.getMenu().add(R.string.poi_context_menu_modify_osm_change)
.setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_edit_dark));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {

View file

@ -45,7 +45,7 @@ public class SendPoiDialogFragment extends DialogFragment {
passwordEditText.setText(settings.USER_PASSWORD.get());
boolean hasOsmPOI = false;
for(OsmPoint p : poi) {
if(p instanceof OpenstreetmapPoint) {
if (p.getGroup() == OsmPoint.Group.POI) {
hasOsmPOI = true;
break;
}