if statemnt added in case of empty

This commit is contained in:
Adam Domagalski 2018-11-07 00:28:19 +01:00
parent 295be86eee
commit 5d595c4c65

View File

@ -348,12 +348,19 @@ public class MapActivity extends BaseActivity
@Override @Override
public void onSuccess(List<Coordinate> coordsList) { public void onSuccess(List<Coordinate> coordsList) {
ArrayList<String> currentCoordsIds = new ArrayList<>(); if(coordsList.isEmpty()) {
for (Coordinate coordinate : coordsList) { Log.e(tag, "200 empty []");
currentCoordsIds.add(coordinate.getUserId()); mapboxMap.clear();
return;
} }
// Set<String> currentCoordsIds = new HashSet<String>(tmp);
ArrayList<String> tmp = new ArrayList<>();
for (Coordinate coordinate : coordsList) {
tmp.add(coordinate.getUserId());
}
Set<String> currentCoordsIds = new HashSet<>(tmp);
if (previousCoordsIds.isEmpty()){ if (previousCoordsIds.isEmpty()){
previousCoordsIds.addAll(currentCoordsIds); previousCoordsIds.addAll(currentCoordsIds);
} else { } else {
@ -366,6 +373,7 @@ public class MapActivity extends BaseActivity
coordsMap.remove(toRemoveId); coordsMap.remove(toRemoveId);
} }
} else { } else {
// TODO double check when some markers api will change
Log.e(tag+ "delete: ","nothing to remove"); Log.e(tag+ "delete: ","nothing to remove");
} }
} }