Added layer for local changes.
This commit is contained in:
parent
6f46b3b576
commit
1a92be876e
8 changed files with 308 additions and 81 deletions
|
@ -58,8 +58,9 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/direction_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="@dimen/dashFavDirectionSize"
|
||||
android:layout_height="@dimen/dashFavDirectionSize"
|
||||
tools:src="@drawable/ic_action_start_navigation"/>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package net.osmand.plus.audionotes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.PointF;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
|
@ -18,17 +27,9 @@ import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
|||
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.PointF;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.text.TextWatcher;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -61,11 +60,12 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class EditingPOIActivity implements DialogProvider {
|
||||
public class EditingPOIDialogProvider implements DialogProvider {
|
||||
|
||||
private final Activity activity;
|
||||
private final OpenstreetmapUtil openstreetmapUtil;
|
||||
private final OpenstreetmapUtil openstreetmapUtilToLoad;
|
||||
private final OsmEditingPlugin plugin;
|
||||
private AutoCompleteTextView typeText;
|
||||
private EditText nameText;
|
||||
private Button typeButton;
|
||||
|
@ -98,8 +98,9 @@ public class EditingPOIActivity implements DialogProvider {
|
|||
private Map<String, PoiType> allTranslatedSubTypes;
|
||||
|
||||
|
||||
public EditingPOIActivity(MapActivity uiContext){
|
||||
public EditingPOIDialogProvider(MapActivity uiContext, OsmEditingPlugin plugin){
|
||||
this.activity = uiContext;
|
||||
this.plugin = plugin;
|
||||
|
||||
poiTypes = uiContext.getMyApplication().getPoiTypes();
|
||||
allTranslatedSubTypes = poiTypes.getAllTranslatedNames(false);
|
||||
|
@ -637,6 +638,7 @@ public class EditingPOIActivity implements DialogProvider {
|
|||
@Override
|
||||
protected void onPostExecute(Node result) {
|
||||
progress.dismiss();
|
||||
plugin.collectLocalOsmEdits();
|
||||
if (result != null) {
|
||||
successAction.run();
|
||||
}
|
|
@ -1,14 +1,20 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -34,26 +40,20 @@ import org.apache.commons.logging.Log;
|
|||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider, DialogProvider {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(OsmBugsLayer.class);
|
||||
private final static int startZoom = 8;
|
||||
|
||||
private final OsmEditingPlugin plugin;
|
||||
|
||||
private OsmandMapTileView view;
|
||||
|
||||
private Paint pointClosedUI;
|
||||
|
@ -74,8 +74,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
private OsmBugsRemoteUtil remote;
|
||||
private MapLayerData<List<OpenStreetNote>> data;
|
||||
|
||||
public OsmBugsLayer(MapActivity activity){
|
||||
public OsmBugsLayer(MapActivity activity, OsmEditingPlugin plugin){
|
||||
this.activity = activity;
|
||||
this.plugin = plugin;
|
||||
local = new OsmBugsLocalUtil(activity);
|
||||
remote = new OsmBugsRemoteUtil(activity.getMyApplication());
|
||||
}
|
||||
|
@ -219,6 +220,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
if(data != null) {
|
||||
data.clearCache();
|
||||
}
|
||||
if (plugin != null){
|
||||
plugin.collectLocalOsmEdits();
|
||||
}
|
||||
}
|
||||
|
||||
private static String readText(XmlPullParser parser, String key) throws XmlPullParserException, IOException {
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.EnumAdapter;
|
||||
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -34,12 +15,34 @@ import android.widget.EditText;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.DataTileManager;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.EnumAdapter;
|
||||
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class OsmEditingPlugin extends OsmandPlugin {
|
||||
private static final String ID = "osm.editing";
|
||||
private OsmandSettings settings;
|
||||
private OsmandApplication app;
|
||||
|
||||
DataTileManager<OsmPoint> localOsmEdits = new DataTileManager<>();
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
|
@ -47,6 +50,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
|
||||
public OsmEditingPlugin(OsmandApplication app) {
|
||||
this.app = app;
|
||||
collectLocalOsmEdits();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +60,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
private OsmBugsLayer osmBugsLayer;
|
||||
private EditingPOIActivity poiActions;
|
||||
private OsmEditsLayer osmEditsLayer;
|
||||
private EditingPOIDialogProvider poiActions;
|
||||
|
||||
@Override
|
||||
public void updateLayers(OsmandMapTileView mapView, MapActivity activity){
|
||||
|
@ -74,7 +79,16 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public void registerLayers(MapActivity activity){
|
||||
osmBugsLayer = new OsmBugsLayer(activity);
|
||||
osmBugsLayer = new OsmBugsLayer(activity, this);
|
||||
osmEditsLayer = new OsmEditsLayer(activity, this);
|
||||
activity.getMapView().addLayer(osmEditsLayer, 3.5f);
|
||||
}
|
||||
|
||||
public OsmEditsLayer getOsmEditsLayer(MapActivity activity){
|
||||
if(osmEditsLayer == null) {
|
||||
registerLayers(activity);
|
||||
}
|
||||
return osmEditsLayer;
|
||||
}
|
||||
|
||||
public OsmBugsLayer getBugsLayer(MapActivity activity) {
|
||||
|
@ -87,7 +101,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
@Override
|
||||
public void mapActivityCreate(MapActivity activity) {
|
||||
// Always create new actions !
|
||||
poiActions = new EditingPOIActivity(activity);
|
||||
poiActions = new EditingPOIDialogProvider(activity, this);
|
||||
activity.addDialogProvider(getPoiActions(activity));
|
||||
activity.addDialogProvider(getBugsLayer(activity));
|
||||
}
|
||||
|
@ -98,9 +112,9 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
return SettingsOsmEditingActivity.class;
|
||||
}
|
||||
|
||||
public EditingPOIActivity getPoiActions(MapActivity activity) {
|
||||
public EditingPOIDialogProvider getPoiActions(MapActivity activity) {
|
||||
if(poiActions == null) {
|
||||
poiActions = new EditingPOIActivity(activity);
|
||||
poiActions = new EditingPOIDialogProvider(activity, this);
|
||||
}
|
||||
return poiActions;
|
||||
}
|
||||
|
@ -208,7 +222,11 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}).position(5).reg();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onLocalItemDeleted(OsmPoint point) {
|
||||
localOsmEdits.unregisterObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
|
||||
public enum UploadVisibility implements IEnumWithResource {
|
||||
Public(R.string.gpxup_public),
|
||||
Identifiable(R.string.gpxup_identifiable),
|
||||
|
@ -264,7 +282,33 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
bldr.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void onLocalOsmEditAdded(OsmPoint point){
|
||||
localOsmEdits.registerObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
|
||||
public void collectLocalOsmEdits(){
|
||||
localOsmEdits.clear();
|
||||
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(app);
|
||||
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(app);
|
||||
|
||||
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
|
||||
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
|
||||
for (OsmPoint point : l1){
|
||||
localOsmEdits.registerObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
for (OsmPoint point : l2){
|
||||
localOsmEdits.registerObject(point.getLatitude(), point.getLongitude(), point);
|
||||
}
|
||||
}
|
||||
|
||||
public DataTileManager<OsmPoint> getLocalOsmEdits(){
|
||||
return localOsmEdits;
|
||||
}
|
||||
|
||||
public List<OsmPoint> getAllEdits(){
|
||||
return localOsmEdits.getAllObjects();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -306,16 +306,18 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
Iterator<OsmPoint> it = points.iterator();
|
||||
while (it.hasNext()) {
|
||||
OsmPoint info = it.next();
|
||||
if (info.getGroup() == OsmPoint.Group.POI) {
|
||||
dbpoi.deletePOI((OpenstreetmapPoint) info);
|
||||
} else if (info.getGroup() == OsmPoint.Group.BUG) {
|
||||
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
|
||||
OsmPoint omsPoint = it.next();
|
||||
if (omsPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
dbpoi.deletePOI((OpenstreetmapPoint) omsPoint);
|
||||
} else if (omsPoint.getGroup() == OsmPoint.Group.BUG) {
|
||||
dbbug.deleteAllBugModifications((OsmNotesPoint) omsPoint);
|
||||
}
|
||||
it.remove();
|
||||
listAdapter.delete(info);
|
||||
listAdapter.delete(omsPoint);
|
||||
plugin.onLocalItemDeleted(omsPoint);
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
});
|
||||
b.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
|
@ -620,6 +622,7 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
|
|||
|
||||
@Override
|
||||
public void uploadUpdated(OsmPoint point) {
|
||||
plugin.onLocalItemDeleted(point);
|
||||
listAdapter.delete(point);
|
||||
}
|
||||
|
||||
|
|
177
OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java
Normal file
177
OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java
Normal file
|
@ -0,0 +1,177 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
|
||||
import net.osmand.data.DataTileManager;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis on
|
||||
* 20.03.2015.
|
||||
*/
|
||||
public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||
|
||||
private static final int startZoom = 10;
|
||||
private final OsmEditingPlugin plugin;
|
||||
private final MapActivity activity;
|
||||
private Bitmap poi;
|
||||
private Bitmap bug;
|
||||
private OsmandMapTileView view;
|
||||
private Paint pointAtUI;
|
||||
private Paint paintIcon;
|
||||
private Paint point;
|
||||
|
||||
|
||||
|
||||
public OsmEditsLayer(MapActivity activity, OsmEditingPlugin plugin) {
|
||||
this.activity = activity;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initLayer(OsmandMapTileView view) {
|
||||
this.view = view;
|
||||
|
||||
|
||||
pointAtUI = new Paint();
|
||||
pointAtUI.setColor(0xa0FF3344);
|
||||
pointAtUI.setStyle(Paint.Style.FILL);
|
||||
|
||||
poi = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_pin_origin);
|
||||
bug = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_pin_destination);
|
||||
|
||||
paintIcon = new Paint();
|
||||
|
||||
point = new Paint();
|
||||
point.setColor(Color.RED);
|
||||
point.setAntiAlias(true);
|
||||
point.setStyle(Paint.Style.STROKE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||
if (tileBox.getZoom() >= startZoom) {
|
||||
DataTileManager<OsmPoint> points = plugin.getLocalOsmEdits();
|
||||
final QuadRect latlon = tileBox.getLatLonBounds();
|
||||
List<OsmPoint> objects = points.getObjects(latlon. top, latlon.left, latlon.bottom, latlon.right);
|
||||
for (OsmPoint o : objects) {
|
||||
int x = (int) tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
|
||||
int y = (int) tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
|
||||
Bitmap b;
|
||||
if (o.getGroup() == OsmPoint.Group.POI) {
|
||||
b = poi;
|
||||
} else if (o.getGroup() == OsmPoint.Group.BUG) {
|
||||
b = bug;
|
||||
} else {
|
||||
b = poi;
|
||||
|
||||
}
|
||||
canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight(), paintIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyLayer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean drawInScreenPixels() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void getOsmEditsFromPoint(PointF point, RotatedTileBox tileBox, List<? super OsmPoint> am) {
|
||||
int ex = (int) point.x;
|
||||
int ey = (int) point.y;
|
||||
int compare = getRadiusPoi(tileBox);
|
||||
int radius = compare * 3 / 2;
|
||||
for (OsmPoint n : plugin.getAllEdits()) {
|
||||
int x = (int) tileBox.getPixXFromLatLon(n.getLatitude(), n.getLongitude());
|
||||
int y = (int) tileBox.getPixYFromLatLon(n.getLatitude(), n.getLongitude());
|
||||
if (calculateBelongs(ex, ey, x, y, compare)) {
|
||||
compare = radius;
|
||||
am.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) {
|
||||
return Math.abs(objx - ex) <= radius && (ey - objy) <= radius / 2 && (objy - ey) <= 3 * radius ;
|
||||
}
|
||||
|
||||
public int getRadiusPoi(RotatedTileBox tb){
|
||||
int r = 0;
|
||||
if(tb.getZoom() < startZoom){
|
||||
r = 0;
|
||||
} else {
|
||||
r = 15;
|
||||
}
|
||||
return (int) (r * tb.getDensity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
||||
getOsmEditsFromPoint(point, tileBox, o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LatLon getObjectLocation(Object o) {
|
||||
if (o instanceof OsmPoint) {
|
||||
return new LatLon(((OsmPoint)o).getLatitude(),((OsmPoint)o).getLongitude());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectDescription(Object o) {
|
||||
if(o instanceof OsmPoint) {
|
||||
OsmPoint point = (OsmPoint) o;
|
||||
if (point.getGroup() == OsmPoint.Group.POI){
|
||||
return ((OpenstreetmapPoint) point).getName();
|
||||
} else if (point.getGroup() == OsmPoint.Group.BUG) {
|
||||
return ((OsmNotesPoint) point).getText();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof OsmPoint) {
|
||||
OsmPoint point = (OsmPoint) o;
|
||||
String name = "";
|
||||
String type = "";
|
||||
if (point.getGroup() == OsmPoint.Group.POI){
|
||||
name = ((OpenstreetmapPoint) point).getName();
|
||||
type = PointDescription.POINT_TYPE_OSM_NOTE;
|
||||
} else if (point.getGroup() == OsmPoint.Group.BUG) {
|
||||
name = ((OsmNotesPoint) point).getText();
|
||||
type = PointDescription.POINT_TYPE_OSM_BUG;
|
||||
}
|
||||
return new PointDescription(type, name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,12 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.osm.edit.EntityInfo;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
|
@ -41,6 +35,7 @@ public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPo
|
|||
this.remotepoi = remotepoi;
|
||||
this.remotebug = remotebug;
|
||||
this.listSize = listSize;
|
||||
this.ctx = ctx;
|
||||
dbpoi = new OpenstreetmapsDbHelper(ctx.getActivity());
|
||||
dbbug = new OsmBugsDbHelper(ctx.getActivity());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue