Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-15 21:42:35 +01:00
commit fa8c1eee8f
10 changed files with 46 additions and 14 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) {
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

@ -305,6 +305,7 @@ public class EditPoiDialogFragment extends DialogFragment {
private void save() {
Node original = editPoiData.getEntity();
final boolean offlineEdit = mOpenstreetmapUtil instanceof OpenstreetmapLocalUtil;
Node node = new Node(original.getLatitude(), original.getLongitude(), original.getId());
OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
for (Map.Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
@ -319,6 +320,9 @@ public class EditPoiDialogFragment extends DialogFragment {
node.putTag(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue());
}
if(offlineEdit && !Algorithms.isEmpty(tag.getValue())) {
node.putTag(tag.getKey(), tag.getValue());
}
} else if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue())) {
node.putTag(tag.getKey(), tag.getValue());
}
@ -330,7 +334,7 @@ public class EditPoiDialogFragment extends DialogFragment {
@Override
public void run() {
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
if (plugin != null && mOpenstreetmapUtil instanceof OpenstreetmapLocalUtil) {
if (plugin != null && offlineEdit) {
List<OpenstreetmapPoint> points = plugin.getDBPOI().getOpenstreetmapPoints();
if (getActivity() instanceof MapActivity && points.size() > 0) {
OsmPoint point = points.get(points.size() - 1);
@ -633,7 +637,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;
@ -61,12 +61,16 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
Node entity = new Node(n.getLocation().getLatitude(),
n.getLocation().getLongitude(),
nodeId);
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue());
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getTranslation());
if(poiType.getOsmTag2() != null) {
entity.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
}
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

@ -364,7 +364,7 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
if (entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50) {
PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType());
entity.removeTag(poiType.getOsmTag());
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue());
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getTranslation());
return entity;
}
return null;

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

@ -61,7 +61,7 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil {
@Override
public OsmBugResult reopenBug(double latitude, double longitude, long id, String text){
StringBuilder b = new StringBuilder();
b.append(getNotesApi()).append("?"); //$NON-NLS-1$
b.append(getNotesApi()).append("/"); //$NON-NLS-1$
b.append(id); //$NON-NLS-1$
b.append("/reopen?text=").append(URLEncoder.encode(text)); //$NON-NLS-1$
return editingPOI(b.toString(), "POST", "reopen bug"); //$NON-NLS-1$

View file

@ -346,9 +346,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
public static String getEditName(OsmPoint point) {
String prefix = getPrefix(point);
if (point.getGroup() == OsmPoint.Group.POI) {
return prefix + " (" + ((OpenstreetmapPoint) point).getSubtype() + ") " + ((OpenstreetmapPoint) point).getName();
String subtype = "";
if (!Algorithms.isEmpty(((OpenstreetmapPoint) point).getSubtype())) {
subtype = " (" + ((OpenstreetmapPoint) point).getSubtype() + ") ";
}
return prefix + subtype + ((OpenstreetmapPoint) point).getName();
} else if (point.getGroup() == OsmPoint.Group.BUG) {
return prefix + " (" + ((OsmNotesPoint) point).getAuthor() + ") " + ((OsmNotesPoint) point).getText();
return prefix + ((OsmNotesPoint) point).getText();
} else {
return prefix;
}

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;
@ -352,6 +352,8 @@ public class OsmEditsFragment extends OsmAndListFragment
descr.setText(R.string.action_modify);
} else if (child.getAction() == OsmPoint.Action.DELETE) {
descr.setText(R.string.action_delete);
} else if (child.getAction() == OsmPoint.Action.REOPEN) {
descr.setText(R.string.action_modify);
}
}
@ -465,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() {
@ -568,6 +570,8 @@ public class OsmEditsFragment extends OsmAndListFragment
sz.endTag("", "create");
sz.startTag("", "modify");
writeContent(sz, points, OsmPoint.Action.MODIFY);
writeContent(sz, points, OsmPoint.Action.REOPEN);
sz.endTag("", "modify");
sz.startTag("", "delete");
writeContent(sz, points, OsmPoint.Action.DELETE);
@ -599,6 +603,9 @@ public class OsmEditsFragment extends OsmAndListFragment
sz.attribute("", "version", "1");
for (String tag : p.getEntity().getTagKeySet()) {
String val = p.getEntity().getTag(tag);
if (val == null || val.length() == 0 || tag.length() == 0 || "poi_type_tag".equals(tag)) {
continue;
}
sz.startTag("", "tag");
sz.attribute("", "k", tag);
sz.attribute("", "v", val);

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;
}