Exemplo n.º 1
0
  private void saveState() {
    IGeoPoint point = map.getMapCenter();

    storage.writeInteger(solidKey + LONGITUDE_SUFFIX, point.getLongitudeE6());
    storage.writeInteger(solidKey + LATITUDE_SUFFIX, point.getLatitudeE6());
    storage.writeInteger(solidKey + ZOOM_SUFFIX, map.getZoomLevel());
  }
Exemplo n.º 2
0
  private void loadState() {
    location =
        new GeoPoint(
            storage.readInteger(solidKey + LATITUDE_SUFFIX),
            storage.readInteger(solidKey + LONGITUDE_SUFFIX));

    MapController controller = map.getController();
    controller.setZoom(storage.readInteger(solidKey + ZOOM_SUFFIX));
    controller.setCenter(location);
  }
Exemplo n.º 3
0
  private OsmInteractiveView(
      Context context, DispatcherInterface dispatcher, String key, DynTileProvider p) {
    super(context, p, new MapDensity(context));

    // provider = p;

    solidKey = key;

    storage = Storage.global(context);
    slock = new SolidPositionLock(context, solidKey);

    map.setMapListener(this);
    map.setOnTouchListener(this);

    loadState();

    dispatcher.addTarget(this, InfoID.LOCATION);
  }
Exemplo n.º 4
0
 @Override
 public void onAttachedToWindow() {
   super.onAttachedToWindow();
   storage.register(this);
 }
Exemplo n.º 5
0
 @Override
 public void onDetachedFromWindow() {
   saveState();
   storage.unregister(this);
   super.onDetachedFromWindow();
 }