istutor bugifx map
This commit is contained in:
parent
8fbce4d9d3
commit
66dba76ed4
@ -95,11 +95,12 @@ public class MapActivity extends BaseActivity
|
|||||||
private int bearingParam = 180;
|
private int bearingParam = 180;
|
||||||
private int tiltParam = 30;
|
private int tiltParam = 30;
|
||||||
private String myId;
|
private String myId;
|
||||||
|
private boolean isTutor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
isTutor = PrefUtils.getIsTutor(this);
|
||||||
myId = PrefUtils.getUserId(getApplicationContext());
|
myId = PrefUtils.getUserId(getApplicationContext());
|
||||||
|
|
||||||
coordinateService = ApiClient.getClient(getApplicationContext())
|
coordinateService = ApiClient.getClient(getApplicationContext())
|
||||||
@ -136,8 +137,9 @@ public class MapActivity extends BaseActivity
|
|||||||
|
|
||||||
mapboxMap.setOnMarkerClickListener(marker -> {
|
mapboxMap.setOnMarkerClickListener(marker -> {
|
||||||
String id = markerUserHash.get(marker.getId());
|
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);
|
selectLocationButton.setVisibility(View.GONE);
|
||||||
removeLocationButton.setVisibility(View.VISIBLE);
|
removeLocationButton.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@ -157,8 +159,7 @@ public class MapActivity extends BaseActivity
|
|||||||
});
|
});
|
||||||
|
|
||||||
setToggleMapBoundsArea();
|
setToggleMapBoundsArea();
|
||||||
|
if (isTutor) {
|
||||||
if (PrefUtils.getIsTutor(this)) {
|
|
||||||
setOnMapLongClickListener();
|
setOnMapLongClickListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +281,7 @@ public class MapActivity extends BaseActivity
|
|||||||
// PrefUtils.getUserId(getApplicationContext()),
|
// PrefUtils.getUserId(getApplicationContext()),
|
||||||
// PrefUtils.getLocationLevel(getApplicationContext())
|
// PrefUtils.getLocationLevel(getApplicationContext())
|
||||||
// );
|
// );
|
||||||
manualLocationUtils.showLocationDialog("Name the location",latLng);
|
manualLocationUtils.showLocationDialog("Name the location", latLng);
|
||||||
handleBackgroundTaskLifeCycle();
|
handleBackgroundTaskLifeCycle();
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -364,7 +365,7 @@ public class MapActivity extends BaseActivity
|
|||||||
Marker marker = markerHash.get(id).getMarker();
|
Marker marker = markerHash.get(id).getMarker();
|
||||||
Boolean showModalAfterAnimation = false;
|
Boolean showModalAfterAnimation = false;
|
||||||
|
|
||||||
if(marker.isInfoWindowShown()){
|
if (marker.isInfoWindowShown()) {
|
||||||
marker.hideInfoWindow();
|
marker.hideInfoWindow();
|
||||||
showModalAfterAnimation = true;
|
showModalAfterAnimation = true;
|
||||||
}
|
}
|
||||||
@ -380,12 +381,11 @@ public class MapActivity extends BaseActivity
|
|||||||
markerAnimator.start();
|
markerAnimator.start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
coordsMap.put(id, element);
|
coordsMap.put(id, element);
|
||||||
marker.setPosition(toDestination);
|
marker.setPosition(toDestination);
|
||||||
|
|
||||||
|
|
||||||
if(showModalAfterAnimation){
|
if (showModalAfterAnimation) {
|
||||||
mapboxMap.selectMarker(marker);
|
mapboxMap.selectMarker(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,8 +393,6 @@ public class MapActivity extends BaseActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//Add new marker
|
//Add new marker
|
||||||
coordsMap.put(id, element);
|
coordsMap.put(id, element);
|
||||||
@ -435,18 +433,6 @@ public class MapActivity extends BaseActivity
|
|||||||
// For next fetch
|
// For next fetch
|
||||||
previousCoordsIds.clear();
|
previousCoordsIds.clear();
|
||||||
previousCoordsIds.addAll(currentCoordsIds);
|
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
|
@Override
|
||||||
@ -463,7 +449,7 @@ public class MapActivity extends BaseActivity
|
|||||||
if (sharingLevel.equals(SharingLevel.APPROXIMATED.toString())) {
|
if (sharingLevel.equals(SharingLevel.APPROXIMATED.toString())) {
|
||||||
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.approximate_localization_marker);
|
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.approximate_localization_marker);
|
||||||
} else if (sharingLevel.equals(SharingLevel.MANUAL.toString()) ||
|
} 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);
|
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.manual_localization_marker);
|
||||||
} else if (id.equals(myId)) {
|
} else if (id.equals(myId)) {
|
||||||
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.my_marker);
|
defaultIcon = IconFactory.getInstance(MapActivity.this).fromResource(R.drawable.my_marker);
|
||||||
@ -649,7 +635,7 @@ public class MapActivity extends BaseActivity
|
|||||||
for (MapMarker marker : markersToSet) {
|
for (MapMarker marker : markersToSet) {
|
||||||
marker.getMarker().setIcon(markedMarker);
|
marker.getMarker().setIcon(markedMarker);
|
||||||
|
|
||||||
if(markersToSet.size() == 1)
|
if (markersToSet.size() == 1)
|
||||||
mapboxMap.selectMarker(marker.getMarker());
|
mapboxMap.selectMarker(marker.getMarker());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user