Ejemplo n.º 1
0
  @Override
  protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();

    myLocationOverlay.disableMyLocation();
    myLocationOverlay.disableCompass();
  }
 private void enableLocation() {
   try {
     // force it to think it's own location listening is on
     myLocationOverlay.mLocationListener = new LocationListenerProxy(null);
     STATIC_LOCATION_LISTENER = myLocationOverlay;
     MainActivity.getListActivity(this).getGPSListener().setMapListener(myLocationOverlay);
     myLocationOverlay.enableMyLocation();
   } catch (Exception ex) {
     ListActivity.error("Could not enableLocation for maps: " + ex, ex);
   }
 }
Ejemplo n.º 3
0
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   try {
     super.onResume();
     PhimpMe.showTabs();
     if (PhimpMe.IdList.size() == 5) {
       PhimpMe.IdList.clear();
       PhimpMe.IdList.add(0);
     }
     PhimpMe.IdList.add(1);
     myLocationOverlay.enableMyLocation();
     myLocationOverlay.enableCompass();
   } catch (UnsupportedOperationException e) {
   }
 }
  private void setupMapView(final IGeoPoint oldCenter, final int oldZoom) {
    // view
    final RelativeLayout rlView = (RelativeLayout) this.findViewById(R.id.map_rl);

    // tryEvil();

    // possibly choose goog maps here
    mapView = new MapView(this, 256);

    if (mapView instanceof View) {
      ViewGroup.LayoutParams params =
          new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
      ((View) mapView).setLayoutParams(params);
    }

    if (mapView instanceof MapView) {
      final MapView osmMapView = (MapView) mapView;
      rlView.addView(osmMapView);
      osmMapView.setBuiltInZoomControls(true);
      osmMapView.setMultiTouchControls(true);

      // my location overlay
      myLocationOverlay = new MyLocationOverlay(getApplicationContext(), osmMapView);
      myLocationOverlay.setLocationUpdateMinTime(ListActivity.LOCATION_UPDATE_INTERVAL);
      myLocationOverlay.setDrawAccuracyEnabled(false);
      osmMapView.getOverlays().add(myLocationOverlay);

      final OpenStreetMapViewWrapper overlay = new OpenStreetMapViewWrapper(this);
      osmMapView.getOverlays().add(overlay);
    }

    // controller
    mapControl = mapView.getController();
    final IGeoPoint centerPoint = getCenter(this, oldCenter, previousLocation);
    int zoom = DEFAULT_ZOOM;
    if (oldZoom >= 0) {
      zoom = oldZoom;
    } else {
      final SharedPreferences prefs = getSharedPreferences(ListActivity.SHARED_PREFS, 0);
      zoom = prefs.getInt(ListActivity.PREF_PREV_ZOOM, zoom);
    }
    mapControl.setCenter(centerPoint);
    mapControl.setZoom(zoom);
    mapControl.setCenter(centerPoint);

    ListActivity.info("done setupMapView. zoom: " + zoom);
  }
  private void disableLocation() {
    myLocationOverlay.mLocationListener = null;

    // Update the screen to see changes take effect
    if (mapView instanceof View) {
      ((View) mapView).postInvalidate();
    }
  }
  @Override
  public void onResume() {
    ListActivity.info("resume mapping.");
    myLocationOverlay.enableCompass();
    enableLocation();

    super.onResume();
  }
  @Override
  public void onPause() {
    ListActivity.info("pause mapping.");
    myLocationOverlay.disableCompass();
    disableLocation();

    super.onPause();
  }