Fix small issues

This commit is contained in:
Alex 2017-09-14 11:51:52 +03:00
parent 8b6255142e
commit 00caf48eea
2 changed files with 12 additions and 4 deletions

View file

@ -306,8 +306,17 @@ public class MapMarkersHelper {
boolean exists = false;
for (MapMarker marker : dbMarkers) {
if (marker.point.equals(fpLatLon) && marker.getName(ctx).equals(fp.getName(ctx))) {
if (marker.id.equals(group.getId() + fp.getName(ctx))) {
exists = true;
if (!marker.history && !marker.point.equals(fpLatLon)) {
for (MapMarker m : mapMarkers) {
if (m.id.equals(marker.id)) {
m.point = fpLatLon;
updateMapMarker(m, true);
break;
}
}
}
dbMarkers.remove(marker);
break;
}
@ -511,7 +520,7 @@ public class MapMarkersHelper {
MapMarker marker = new MapMarker(point, pointDescription, colorIndex, false, 0);
if (group != null) {
marker.id = group.getId() + marker.getName(ctx) + marker.getLatitude() + marker.getLongitude();
marker.id = group.getId() + marker.getName(ctx);
if (markersDbHelper.getMarker(marker.id) != null) {
continue;
}
@ -531,7 +540,6 @@ public class MapMarkersHelper {
if (marker != null) {
markersDbHelper.updateMarker(marker);
if (refresh) {
loadMarkers();
refresh();
}
}

View file

@ -21,7 +21,7 @@ import java.util.Random;
public class MapMarkersDbHelper {
private static final int DB_VERSION = 6;
private static final int DB_VERSION = 1;
public static final String DB_NAME = "map_markers_db";
private static final String MARKERS_TABLE_NAME = "map_markers";