Change icon when user change localization level

This commit is contained in:
Mieszko Wrzeszczyński 2018-11-23 23:36:04 +01:00
parent 73fc5f9b0b
commit 422b1079da
2 changed files with 18 additions and 15 deletions

View File

@ -337,6 +337,7 @@ public class MapActivity extends BaseActivity
} }
ArrayList<String> tmp = new ArrayList<>(); ArrayList<String> tmp = new ArrayList<>();
for (Coordinate coordinate : coordsList) { for (Coordinate coordinate : coordsList) {
tmp.add(coordinate.getUserId()); tmp.add(coordinate.getUserId());
} }
@ -367,17 +368,16 @@ public class MapActivity extends BaseActivity
String newSharingLevel = element.getDisplayMode(); String newSharingLevel = element.getDisplayMode();
Coordinate coordinate = coordsMap.get(id); Coordinate coordinate = coordsMap.get(id);
Log.e(tag, "hashMapSize: " + coordsMap.size()); /* Log.e(tag, "hashMapSize: " + coordsMap.size());
Log.e(tag, "markerMapSize: " + coordsMap.size()); Log.e(tag, "markerMapSize: " + coordsMap.size());*/
if (coordinate != null) { if (coordinate != null) {
Log.e(tag, "Coordin: " + coordinate.getLatitude() + " | " + coordinate.getLongitude()); Log.e(tag, "Coordin: " + coordinate.getLatitude() + " | " + coordinate.getLongitude());
boolean isTheSameLocalization = coordinate.getLatitude().equals(element.getLatitude()) || coordinate.getLongitude().equals(element.getLongitude());
Log.e(tag, "diff || diff: " + !isTheSameLocalization);
boolean isTheSameLocalisation = coordinate.getLatitude().equals(element.getLatitude()) || coordinate.getLongitude().equals(element.getLongitude()); if (!isTheSameLocalization) {
Log.e(tag, "diff || diff: " + !isTheSameLocalisation);
if (!isTheSameLocalisation) {
Log.e(tag, "replace and animate"); Log.e(tag, "replace and animate");
Marker marker = markerHash.get(id).getMarker(); Marker marker = markerHash.get(id).getMarker();
@ -391,17 +391,12 @@ public class MapActivity extends BaseActivity
markerAnimator.setInterpolator(new LinearInterpolator()); markerAnimator.setInterpolator(new LinearInterpolator());
markerAnimator.start(); markerAnimator.start();
// chba niepotrzbene
mapboxMap.getMarkerViewManager().update(); mapboxMap.getMarkerViewManager().update();
coordsMap.put(id, element); coordsMap.put(id, element);
marker.setPosition(toDestination); marker.setPosition(toDestination);
} }
} else { } else {
Log.e(tag, "Marker Added: " + id); Log.e(tag, "Marker Added: " + id);
@ -439,10 +434,11 @@ public class MapActivity extends BaseActivity
coordsMap.get(id).setLabel(newLabel); coordsMap.get(id).setLabel(newLabel);
boolean newLocalizationMode = coordsMap.get(id).getDisplayMode().equals(newSharingLevel); Boolean newLocalizationMode = markerHash.get(id).getMarkerType().equals(newSharingLevel);
markerHash.get(id).setMarkerType(newSharingLevel);
if(newLocalizationMode){ if(!newLocalizationMode){
Log.e("LOC","Nowy tryb" + coordsMap.get(id).getDisplayMode().toString() + " " + newSharingLevel ); Log.e("LOC","1" + coordsMap.get(id).getDisplayMode().trim() + " " + newSharingLevel);
coordsMap.get(id).setDisplayMode(newSharingLevel); coordsMap.get(id).setDisplayMode(newSharingLevel);
MapMarker marker = markerHash.get(id); MapMarker marker = markerHash.get(id);
@ -460,7 +456,6 @@ public class MapActivity extends BaseActivity
marker.setDefaultIcon(defaultIcon); marker.setDefaultIcon(defaultIcon);
marker.restoreDefaultIcon(); marker.restoreDefaultIcon();
// chba niepotrzbene
mapboxMap.getMarkerViewManager().update(); mapboxMap.getMarkerViewManager().update();
} }

View File

@ -47,4 +47,12 @@ public class MapMarker {
public void setMarker(Marker marker) { public void setMarker(Marker marker) {
this.marker = marker; this.marker = marker;
} }
public String getMarkerType() {
return markerType;
}
public void setMarkerType(String markerType) {
this.markerType = markerType;
}
} }