static marker bug removal

This commit is contained in:
Adam Domagalski 2018-11-26 23:54:12 +01:00
parent 9b291117ef
commit 64082727b2

View File

@ -157,7 +157,7 @@ public class MapActivity extends BaseActivity
setToggleMapBoundsArea();
if (PrefUtils.getIsTutor(this)){
if (PrefUtils.getIsTutor(this)) {
setOnMapLongClickListener();
}
// addStaticLayer();
@ -270,45 +270,6 @@ public class MapActivity extends BaseActivity
PrefUtils.putManualLocation(this, latLng);
handleBackgroundTaskLifeCycle();
// // TODO remove after BG sending
// manualLocStatusChecker = () -> {
// try {
// Log.e(tag + "Manual", "sending manual coords");
// // TODO ^^^ wrapper to removve
// disposable.add(
// coordinateService
// .postCoordinate(droppedMarkercoordinate)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribeWith(new DisposableSingleObserver<Coordinate>() {
// @SuppressLint("LongLogTag")
// @Override
// public void onSuccess(Coordinate coord) {
// Log.e(tag + "POST", String.valueOf(coord));
// }
//
// @SuppressLint("LongLogTag")
// @Override
// public void onError(Throwable e) {
//
// Log.e(tag + "onError", e.getMessage());
//
// if (e instanceof HttpException) {
// ResponseBody responseBody = ((HttpException) e).response().errorBody();
// Log.e(tag + "onError", RestApiHelper.getErrorMessage(responseBody));
//
// }
// }
// }));
// // TODO \/\/\/\/\/ wrapper to removve
// } finally {
// manualLocHandler.postDelayed(manualLocStatusChecker, mInterval);
// }
// };
// manualLocStatusChecker.run();
} catch (IllegalArgumentException e) {
Timber.e(String.valueOf(e));
}
@ -356,16 +317,13 @@ public class MapActivity extends BaseActivity
previousCoordsIds.addAll(currentCoordsIds);
} else {
// here we clear + it returns bool if sth was removed
if (previousCoordsIds.removeAll(currentCoordsIds)) {
for (String toRemoveId : previousCoordsIds) {
Log.e(tag + "delete: ", "removing: " + toRemoveId + ": " + markerHash.get(toRemoveId));
mapboxMap.removeMarker(markerHash.get(toRemoveId));
markerHash.remove(toRemoveId);
coordsMap.remove(toRemoveId);
}
} else {
// TODO double check when some markers api will change
Log.e(tag + "delete: ", "nothing to remove");
previousCoordsIds.removeAll(currentCoordsIds);
for (String toRemoveId : previousCoordsIds) {
Log.e(tag + "delete: ", "removing: " + toRemoveId + ": " + markerHash.get(toRemoveId));
mapboxMap.removeMarker(markerHash.get(toRemoveId));
markerHash.remove(toRemoveId);
coordsMap.remove(toRemoveId);
}
}
@ -402,15 +360,6 @@ public class MapActivity extends BaseActivity
coordsMap.put(id, element);
marker.setPosition(toDestination);
} else if((System.currentTimeMillis() - coordinate.getTimeStamp()) > (long) 300000) {
// TODO debug logic and remove timestamp removing
// String id = coordinate.getUserId();
Marker markerToRemove = markerHash.get(id);
markerHash.remove(id);
coordsMap.remove(id);
mapboxMap.removeMarker(markerToRemove);
currentCoordsIds.remove(id);
}
} else {