Exemplo n.º 1
0
 private void detachOverview() {
   if (!overviewAttached) {
     return;
   }
   for (Marker m : overview) {
     m.setMap(null);
   }
   overviewAttached = false;
 }
Exemplo n.º 2
0
 private void attachOverview() {
   if (overviewAttached) {
     return;
   }
   if (map == null) {
     return;
   }
   for (Marker m : overview) {
     m.setMap(map);
   }
   overviewAttached = true;
 }
Exemplo n.º 3
0
  @Override
  public void dispatch(OverviewEvent event) {
    detachOverview();
    overview.clear();

    if (map == null) {
      pendingOverview = event;
      return;
    }
    for (HumProxy hum : event.hums) {
      PointProxy point = hum.getPoint();
      HumProxy.Level level = hum.getLevel();

      if (point == null || level == null) {
        continue;
      }

      MarkerOptions opts =
          new MarkerOptions.Builder(LatLng.newInstance(point.getLat(), point.getLng()))
              .icon(levelHelper.icon(level))
              .shadow(shadowBuilder.getShadow())
              .animation(Animation.DROP)
              .draggable(false)
              .clickable(false)
              .build();
      Marker marker = Marker.newInstance(opts);
      overview.add(marker);
    }
    detachCurrentHum();
    attachOverview();
  }
Exemplo n.º 4
0
 @Override
 public void dispatch(LevelEvent event) {
   HumProxy.Level level = event.level;
   if (map == null || currentHum == null) {
     pendingLevel = event;
     return;
   }
   currentHum.setIcon(levelHelper.icon(level == null ? HumProxy.Level.HIGH : level));
 }
Exemplo n.º 5
0
 private Marker buildMarkerForCurrentHum(PointProxy point) {
   MarkerOptions opts =
       new MarkerOptions.Builder(LatLng.newInstance(point.getLat(), point.getLng()))
           .icon(levelHelper.icon(HumProxy.Level.HIGH))
           .shadow(shadowBuilder.getShadow())
           //                .shape(red.getShape())
           .animation(Animation.DROP)
           .draggable(true)
           .build();
   Marker marker = Marker.newInstance(opts);
   addDragendListener(marker, firePositionChange);
   return marker;
 }
Exemplo n.º 6
0
 private void putPin(PointProxy point) {
   if (point == null) {
     detachCurrentHum();
     return;
   }
   if (currentHum == null) {
     currentHum = buildMarkerForCurrentHum(point);
     if (pendingLevel != null) {
       dispatch(pendingLevel);
       pendingLevel = null;
     }
   } else {
     currentHum.setPosition(LatLng.newInstance(point.getLat(), point.getLng()));
   }
   attachCurrentHum();
 }
Exemplo n.º 7
0
 private void attachCurrentHum() {
   if (currentHum == null || currentHum.getMap() != null) {
     return;
   }
   currentHum.setMap(map);
 }
Exemplo n.º 8
0
 private void detachCurrentHum() {
   if (currentHum == null || currentHum.getMap() == null) {
     return;
   }
   currentHum.setMap(null);
 }