Skip to content

Commit

Permalink
last location and remove the other marker
Browse files Browse the repository at this point in the history
  • Loading branch information
aykuttasil committed Dec 16, 2016
1 parent 40032af commit bbe21fc
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import hugo.weaving.DebugLog;
import io.reactivex.Observable;
Expand Down Expand Up @@ -255,8 +256,9 @@ private void setMap() {

databaseReference.child(ModelLocation.class.getSimpleName())
.child(modelUserTracker.getUUID())
.limitToLast(2)
.limitToLast(1)
.addChildEventListener(new ChildEventListener() {

@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {

Expand Down Expand Up @@ -330,6 +332,18 @@ private void addMarker(ModelUserTracker modelUserTracker, ModelLocation modelLoc

LatLng latLng = new LatLng(modelLocation.getLatitude(), modelLocation.getLongitude());

for (Map.Entry<Object, Object> entry : mapMarker.entrySet()) {

Marker marker = (Marker) entry.getKey();

ModelLocation location = (ModelLocation) entry.getValue();

if (marker.getTitle().equals(modelUserTracker.getEmail())) {
marker.remove();
}

}

Marker marker = mGoogleMap.addMarker(
new MarkerOptions()
.position(latLng)
Expand Down

0 comments on commit bbe21fc

Please sign in to comment.