/**
   * Populates this bubble with all item info:
   *
   * <ul>
   *   title and description in any case,
   * </ul>
   *
   * <ul>
   *   image and sub-description if any.
   * </ul>
   *
   * and centers the map on the item. <br>
   */
  public void showBubble(ExtendedOverlayItem item, InfoWindow bubble, MapView mapView) {
    Log.d(TAG, "showBubble");
    // offset the bubble to be top-centered on the marker:
    Drawable marker = getMarker(mapView.getZoomLevel());
    int markerWidth = marker.getIntrinsicWidth();
    int markerHeight = marker.getIntrinsicHeight();

    Point markerH = item.getHotspot(HotspotPlace.BOTTOM_CENTER, markerWidth, markerHeight);
    Point bubbleH = item.getHotspot(HotspotPlace.BOTTOM_CENTER, markerWidth, markerHeight);
    bubbleH.offset(-markerH.x, -markerH.y - markerHeight);
    bubble.open(item, bubbleH.x, bubbleH.y);

    mapView.getController().animateTo(item.getPoint());
  }
Esempio n. 2
0
 /**
  * open the window at the specified position.
  *
  * @param item the item on which is hooked the view
  * @param offsetX (&offsetY) the offset of the view to the position, in pixels. This allows to
  *     offset the view from the marker position.
  */
 public void open(ExtendedOverlayItem item, int offsetX, int offsetY) {
   onOpen(item);
   GeoPoint position = item.getPoint();
   MapView.LayoutParams lp =
       new MapView.LayoutParams(
           MapView.LayoutParams.WRAP_CONTENT,
           MapView.LayoutParams.WRAP_CONTENT,
           position,
           MapView.LayoutParams.BOTTOM_CENTER,
           offsetX,
           offsetY);
   // close(); //if it was already opened
   mMapView.removeAllViews();
   mMapView.addView(mView, lp);
   mIsVisible = true;
 }