示例#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());
  }
示例#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);
  }
示例#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);
  }
示例#4
0
 @Override
 public void onAttachedToWindow() {
   super.onAttachedToWindow();
   storage.register(this);
 }
示例#5
0
 @Override
 public void onDetachedFromWindow() {
   saveState();
   storage.unregister(this);
   super.onDetachedFromWindow();
 }