[android] #5102 - update marker view position correctly by comparing markers based on id instead of location

This commit is contained in:
Tobrun Van Nuland
2016-05-24 14:13:28 +02:00
committed by Tobrun Van Nuland
parent 9c9140595e
commit 1d7d8a9f2f
2 changed files with 2 additions and 19 deletions

View File

@@ -166,23 +166,6 @@ public class Marker extends Annotation {
this.rightOffsetPixels = rightOffsetPixels;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Marker marker = (Marker) o;
return !(getPosition() != null ? !getPosition().equals(marker.getPosition()) : marker.getPosition() != null);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getPosition() != null ? getPosition().hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Marker [position[" + getPosition() + "]]";

View File

@@ -70,8 +70,8 @@ public class MarkerTest {
@Test
public void testHashCode() {
Marker marker = new MarkerOptions().position(new LatLng(10, 12)).getMarker();
assertEquals("hash code should match", marker.hashCode(), -1946419200);
Marker marker = new MarkerOptions().getMarker();
assertEquals("hash code should match", marker.hashCode(), 0);
}
@Test