Fix bug on set found object button.
This commit is contained in:
parent
443a7179e8
commit
ed6e900282
|
|
@ -231,19 +231,22 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markAsFound() {
|
private void markAsFound() {
|
||||||
WayPointLocation wpl = serviceGps.foundNearObject();
|
List<WayPointLocation> wpls = serviceGps.foundNearObjects();
|
||||||
if (wpl != null) {
|
for (WayPointLocation wpl: wpls) {
|
||||||
wpl.setFound();
|
if (wpl != null && !wpl.isFound()) {
|
||||||
for (Overlay o : map.getOverlays()) {
|
wpl.setFound();
|
||||||
if (o instanceof Marker) {
|
for (Overlay o : map.getOverlays()) {
|
||||||
Marker marker = (Marker) o;
|
if (o instanceof Marker) {
|
||||||
GeoPoint gp = marker.getPosition();
|
Marker marker = (Marker) o;
|
||||||
if (wpl.isEquals(gp.getLatitude(), gp.getLongitude())) {
|
GeoPoint gp = marker.getPosition();
|
||||||
marker.setIcon(getResources().getDrawable(R.drawable.ic_marker_blue));
|
if (wpl.isEquals(gp.getLatitude(), gp.getLongitude())) {
|
||||||
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
|
marker.setIcon(getResources().getDrawable(R.drawable.ic_marker_blue));
|
||||||
break;
|
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
|
|
@ -168,12 +169,12 @@ public class ServiceGps extends Observable implements IServiceGps, LocationListe
|
||||||
return traces.getPoint(lat, lon);
|
return traces.getPoint(lat, lon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WayPointLocation foundNearObject() {
|
public List<WayPointLocation> foundNearObjects() {
|
||||||
WayPointLocation ret = null;
|
List<WayPointLocation> ret = new ArrayList<>();
|
||||||
MyLocation curLoc = currentLocation;
|
MyLocation curLoc = currentLocation;
|
||||||
for (MyLocation ml: getListGeoPointObjects()) {
|
for (MyLocation ml: getListGeoPointObjects()) {
|
||||||
if (curLoc.distanceTo(ml) < 10 && ml instanceof WayPointLocation) {
|
if (curLoc.distanceTo(ml) < 10 && ml instanceof WayPointLocation) {
|
||||||
ret = (WayPointLocation) ml;
|
ret.add((WayPointLocation) ml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue