recon my own marker
This commit is contained in:
parent
bb4831ec89
commit
49f47986f0
@ -99,13 +99,14 @@ public class MapActivity extends BaseActivity
|
||||
private int zoomParam = 17;
|
||||
private int bearingParam = 180;
|
||||
private int tiltParam = 30;
|
||||
private String myID;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final SharedPreferences sharedPref = getSharedPreferences("fmtPrefs", Context.MODE_PRIVATE);
|
||||
|
||||
|
||||
myID = PrefUtils.getUserId(getApplicationContext());
|
||||
// fetching coords service
|
||||
coordinateService = ApiClient.getClient(getApplicationContext())
|
||||
.create(CoordinateService.class);
|
||||
@ -241,6 +242,9 @@ public class MapActivity extends BaseActivity
|
||||
PrefUtils.getLocationLevel(getApplicationContext())
|
||||
);
|
||||
|
||||
Log.e(tag, "tutajMANUALid: " + PrefUtils.getUserId(getApplicationContext()));
|
||||
Log.e(tag, "tutajMANUALid: " + myID);
|
||||
|
||||
disposable.add(
|
||||
coordinateService
|
||||
.postCoordinate(droppedMarkercoordinate)
|
||||
@ -277,17 +281,17 @@ public class MapActivity extends BaseActivity
|
||||
Toast.LENGTH_LONG
|
||||
).show();
|
||||
|
||||
selectLocationButton.setBackgroundColor(
|
||||
ContextCompat.getColor(MapActivity.this, R.color.colorAccent));
|
||||
selectLocationButton.setText("Remove Manual location");
|
||||
selectLocationButton.setVisibility(View.VISIBLE);
|
||||
selectLocationButton.setBackgroundColor(
|
||||
ContextCompat.getColor(MapActivity.this, R.color.colorAccent));
|
||||
selectLocationButton.setText("Remove Manual location");
|
||||
selectLocationButton.setVisibility(View.VISIBLE);
|
||||
cancel[0] = true;
|
||||
} else {
|
||||
|
||||
// TODO REMOVE Manual Location
|
||||
mapboxMap.removeMarker(droppedMarker);
|
||||
droppedMarker = null;
|
||||
droppedMarkercoordinate = null;
|
||||
mapboxMap.removeMarker(droppedMarker);
|
||||
droppedMarker = null;
|
||||
droppedMarkercoordinate = null;
|
||||
|
||||
Toast.makeText(
|
||||
MapActivity.this,
|
||||
@ -339,7 +343,6 @@ public class MapActivity extends BaseActivity
|
||||
|
||||
private void fetchTopCoords() {
|
||||
|
||||
|
||||
disposable.add(
|
||||
// coordinateService.getTopCoordinates()
|
||||
coordinateService.getOnlineCoordinates()
|
||||
@ -351,18 +354,17 @@ public class MapActivity extends BaseActivity
|
||||
public void onSuccess(List<Coordinate> coordsList) {
|
||||
|
||||
if (droppedMarker != null) {
|
||||
Timber.e("coordsList.add(droppedMarkercoordinate);");
|
||||
coordsList.add(droppedMarkercoordinate);
|
||||
}
|
||||
|
||||
if (coordsList.isEmpty() && droppedMarker == null) {
|
||||
Log.e(tag, "200 empty []");
|
||||
Timber.e("200 empty []");
|
||||
mapboxMap.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ArrayList<String> tmp = new ArrayList<>();
|
||||
for (Coordinate coordinate : coordsList) {
|
||||
tmp.add(coordinate.getUserId());
|
||||
@ -429,9 +431,17 @@ public class MapActivity extends BaseActivity
|
||||
Log.e(tag, "Marker Added: " + id);
|
||||
|
||||
coordsMap.put(id, element);
|
||||
Marker marker = mapboxMap.addMarker(new MarkerOptions()
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.title(id)
|
||||
.position(new LatLng(element.getLatitude(), element.getLongitude())));
|
||||
.position(new LatLng(element.getLatitude(), element.getLongitude()));
|
||||
// Check if this is me
|
||||
if (id.equals(myID)) {
|
||||
Icon icon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.blue_marker);
|
||||
markerOptions.setIcon(icon);
|
||||
}
|
||||
Marker marker = mapboxMap.addMarker(markerOptions);
|
||||
|
||||
markerHash.put(id, marker);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user