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();
}
}
@ -280,7 +281,7 @@ public class MapActivity extends BaseActivity
// PrefUtils.getUserId(getApplicationContext()),
// PrefUtils.getLocationLevel(getApplicationContext())
// );
manualLocationUtils.showLocationDialog("Name the location",latLng);
manualLocationUtils.showLocationDialog("Name the location", latLng);
handleBackgroundTaskLifeCycle();
} catch (IllegalArgumentException e) {
@ -364,7 +365,7 @@ public class MapActivity extends BaseActivity
Marker marker = markerHash.get(id).getMarker();
Boolean showModalAfterAnimation = false;
if(marker.isInfoWindowShown()){
if (marker.isInfoWindowShown()) {
marker.hideInfoWindow();
showModalAfterAnimation = true;
}
@ -380,12 +381,11 @@ public class MapActivity extends BaseActivity
markerAnimator.start();
coordsMap.put(id, element);
marker.setPosition(toDestination);
if(showModalAfterAnimation){
if (showModalAfterAnimation) {
mapboxMap.selectMarker(marker);
}
@ -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
@ -463,7 +449,7 @@ public class MapActivity extends BaseActivity
if (sharingLevel.equals(SharingLevel.APPROXIMATED.toString())) {
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.approximate_localization_marker);
} else if (sharingLevel.equals(SharingLevel.MANUAL.toString()) ||
sharingLevel.equals(SharingLevel.PREDEFINED.toString()) ) {
sharingLevel.equals(SharingLevel.PREDEFINED.toString())) {
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.manual_localization_marker);
} else if (id.equals(myId)) {
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.my_marker);
@ -649,7 +635,7 @@ public class MapActivity extends BaseActivity
for (MapMarker marker : markersToSet) {
marker.getMarker().setIcon(markedMarker);
if(markersToSet.size() == 1)
if (markersToSet.size() == 1)
mapboxMap.selectMarker(marker.getMarker());
}