istutor bugifx map

This commit is contained in:
Adam Domagalski 2018-11-27 16:12:02 +01:00
parent 8fbce4d9d3
commit 66dba76ed4

View File

@ -95,11 +95,12 @@ public class MapActivity extends BaseActivity
private int bearingParam = 180;
private int tiltParam = 30;
private String myId;
private boolean isTutor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isTutor = PrefUtils.getIsTutor(this);
myId = PrefUtils.getUserId(getApplicationContext());
coordinateService = ApiClient.getClient(getApplicationContext())
@ -136,8 +137,9 @@ public class MapActivity extends BaseActivity
mapboxMap.setOnMarkerClickListener(marker -> {
String id = markerUserHash.get(marker.getId());
String locationLevel = PrefUtils.getLocationLevel(getApplicationContext());
if (id.equals(myId)) {
if (id.equals(myId) && (locationLevel.equals(SharingLevel.MANUAL.toString()) || locationLevel.equals(SharingLevel.PREDEFINED.toString()))) {
selectLocationButton.setVisibility(View.GONE);
removeLocationButton.setVisibility(View.VISIBLE);
@ -157,8 +159,7 @@ public class MapActivity extends BaseActivity
});
setToggleMapBoundsArea();
if (PrefUtils.getIsTutor(this)) {
if (isTutor) {
setOnMapLongClickListener();
}
}
@ -380,7 +381,6 @@ public class MapActivity extends BaseActivity
markerAnimator.start();
coordsMap.put(id, element);
marker.setPosition(toDestination);
@ -393,8 +393,6 @@ public class MapActivity extends BaseActivity
}
} else {
//Add new marker
coordsMap.put(id, element);
@ -435,18 +433,6 @@ public class MapActivity extends BaseActivity
// For next fetch
previousCoordsIds.clear();
previousCoordsIds.addAll(currentCoordsIds);
for (Coordinate coordinate : coordsMap.values()) {
// 300000 = 5mins
if ((System.currentTimeMillis() - coordinate.getTimeStamp()) > (long) 300000) {
String id = coordinate.getUserId();
Marker markerToRemove = markerHash.get(id).getMarker();
markerHash.remove(id);
coordsMap.remove(id);
mapboxMap.removeMarker(markerToRemove);
}
}
}
@Override