@Override
 @Subscribe
 public void onEvent(SessionChangeEvent event) {
   super.onEvent(event);
   refreshNotes();
   mapView.invalidate();
 }
  @Override
  protected void onPause() {
    super.onPause();

    measurementPresenter.unregisterListener(this);
    routeRefreshDetector.stop();
    traceOverlay.stopDrawing(mapView);
    heatMapDetector.stop();
    soundTraceDetector.stop();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    noteOverlay.setContext(this);

    setContentView(R.layout.heat_map);

    mapView.getOverlays().add(routeOverlay);
    mapView.getOverlays().add(traceOverlay);

    if (!sessionManager.isSessionSaved()) {
      mapView.getOverlays().add(locationOverlay);
    }
  }
  @Subscribe
  @Override
  public void onEvent(StreamUpdateEvent event) {
    super.onEvent(event);

    runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            mapView.invalidate();
          }
        });

    updater.onMapIdle();
    onMapIdle();
  }
  @Override
  protected void onResume() {
    super.onResume();

    initialize();
    refreshNotes();
    spinnerAnimation.start();
    initializeMap();
    measurementPresenter.registerListener(this);
    initializeRouteOverlay();
    traceOverlay.startDrawing();

    checkConnection();

    updater = new HeatMapUpdater();
    heatMapDetector = detectMapIdle(mapView, HEAT_MAP_UPDATE_TIMEOUT, updater);
    soundTraceDetector = detectMapIdle(mapView, SOUND_TRACE_UPDATE_TIMEOUT, this);
  }
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.toggle_heat_map_button:
       toggleHeatMapVisibility();
       updateButtons();
       break;
     case R.id.zoom_in:
       mapView.getController().zoomIn();
       break;
     case R.id.zoom_out:
       mapView.getController().zoomOut();
       break;
     case R.id.locate:
       centerMap();
       break;
     case R.id.view_photo:
       Intents.viewPhoto(this, photoUri());
       break;
     default:
       super.onClick(view);
   }
 }
  @Override
  protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    zoomToSession = false;
  }