/** * @param layoutResId the id of the view resource. * @param mapView the mapview on which is hooked the view */ public InfoWindow(int layoutResId, MapView mapView) { mMapView = mapView; mIsVisible = false; ViewGroup parent = (ViewGroup) mapView.getParent(); Context context = mapView.getContext(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = inflater.inflate(layoutResId, parent, false); }
public MapDataManager(MapView mMapView, ResourceProxy rProxy) { mapView = mMapView; mContext = mMapView.getContext(); mResourceProxy = rProxy; initializeOverlays(mContext); mapView.setMapListener(this); loadMapTask = new LoadMapDataTask(); loadMapTask.execute(); // load graph and nodes to display }
/** * Smoothly animates the {@link MapView} so that it centers on the user location. In case, no * location is currently available, the error message is displayed to the user via a regular * Toast. * * @param mapView The {@link MapView} to animate * @param myLocationOverlay The {@link MyLocationOverlay} whose location will be used to determine * the user location. * @param errorMessage The message to display in case no location is available. */ public static void smoothCenterOnUserLocation( MapView mapView, MyLocationOverlay myLocationOverlay, String errorMessage) { if (myLocationOverlay == null) { return; } final GeoPoint myLocation = myLocationOverlay.getLastFixAsGeoPoint(); if (myLocation != null) { // TODO Cyril: Find a way to stop all animations // prior animating to the given location otherwise the call // to animateTo is no-op. None of the methods I've tried can // stop the fling animation :s // getController().stopPanning(); // mapView.getController().animateTo(myLocation); mapView.getController().setCenter(myLocation); } else { Toast.makeText(mapView.getContext(), errorMessage, Toast.LENGTH_SHORT).show(); } }
public Marker(MapView mapView, final Context resourceProxy) { super(resourceProxy); resource = mapView.getContext().getResources(); mBearing = 0.0f; mAlpha = 1.0f; // opaque mPosition = new GeoPoint(0.0, 0.0); mAnchorU = ANCHOR_CENTER; mAnchorV = ANCHOR_CENTER; mIWAnchorU = ANCHOR_CENTER; mIWAnchorV = ANCHOR_TOP; mDraggable = false; mIsDragged = false; mPositionPixels = new Point(); mPanToView = true; mFlat = false; // billboard mOnMarkerClickListener = null; mOnMarkerDragListener = null; if (mDefaultIcon == null) mDefaultIcon = resourceProxy.getResources().getDrawable(R.drawable.marker_default); mIcon = mDefaultIcon; if (mDefaultInfoWindow == null || mDefaultInfoWindow.getMapView() != mapView) { // build default bubble, that will be shared between all markers using the default one: /* pre-aar version Context context = mapView.getContext(); String packageName = context.getPackageName(); int defaultLayoutResId = context.getResources().getIdentifier("bonuspack_bubble", "layout", packageName); if (defaultLayoutResId == 0) Log.e(BonusPackHelper.LOG_TAG, "Marker: layout/bonuspack_bubble not found in "+packageName); else mDefaultInfoWindow = new MarkerInfoWindow(defaultLayoutResId, mapView); */ // get the default layout now included in the aar library mDefaultInfoWindow = new MarkerInfoWindow(R.layout.bonuspack_bubble, mapView); } setInfoWindow(mDefaultInfoWindow); }
public Marker(MapView mapView) { this(mapView, (mapView.getContext())); }
public Marker(MapView mapView) { this(mapView, new DefaultResourceProxyImpl(mapView.getContext())); }