Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 private boolean openBubble(MapView mapView, GeoTrack geoTrack) {
   boolean isRecycled = true;
   if (balloonView == null) {
     Log.d(TAG, "on openBubble Create new GeoTrackBubble");
     balloonView = new GeoTrackBubble(context);
     balloonView.setVisibility(View.GONE);
     balloonView.setDisplayGeoLoc(
         sharedPreferences.getBoolean(AppConstants.PREFS_KEY_MYLOCATION_DISPLAY_GEOLOC, false));
     isRecycled = false;
   }
   boolean balloonViewNotVisible = (View.VISIBLE != balloonView.getVisibility());
   Log.d(TAG, "on openBubble : balloonViewNotVisible = " + balloonViewNotVisible);
   if (balloonViewNotVisible) {
     // Compute Offset
     int offsetX = 0; // 150
     int offsetY = -20; // -20
     // Position Layout
     balloonViewLayoutParams =
         new MapView.LayoutParams(
             MapView.LayoutParams.WRAP_CONTENT,
             MapView.LayoutParams.WRAP_CONTENT,
             geoTrack.asGeoPoint(),
             MapView.LayoutParams.BOTTOM_CENTER,
             offsetX,
             offsetY);
     if (isRecycled) {
       balloonView.setLayoutParams(balloonViewLayoutParams);
       Log.d(TAG, "on openBubble : setLayoutParams = " + balloonViewLayoutParams);
     } else {
       mapView.addView(balloonView, balloonViewLayoutParams);
       Log.d(TAG, "on openBubble : addView = " + balloonViewLayoutParams);
     }
     balloonView.setVisibility(View.VISIBLE);
     // balloonView.setData(lastFix);
     setBubbleData(geoTrack);
     return true;
   } else {
     return hideBubble(mapView);
   }
 }