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

View File

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