@Override
  public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
    boolean isNight = nightMode != null && nightMode.isNightMode();
    int shadw = isNight ? Color.TRANSPARENT : Color.WHITE;
    int textColor = isNight ? NIGHT_COLOR : Color.BLACK;
    if (shadowColor != shadw) {
      shadowColor = shadw;
      updatextColor(textColor, shadw, rulerControl, zoomControls, mapMenuControls);
    }
    // default buttons
    boolean routePlanningMode = false;
    RoutingHelper rh = mapActivity.getRoutingHelper();
    if (rh.isRoutePlanningMode()) {
      routePlanningMode = true;
    } else if ((rh.isRouteCalculated() || rh.isRouteBeingCalculated()) && !rh.isFollowingMode()) {
      routePlanningMode = true;
    }
    boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
    boolean showDefaultButtons =
        !routePlanningMode && (!routeFollowingMode || settings.SHOW_ZOOM_BUTTONS_NAVIGATION.get());
    if (routePlanningMode) {
      forceHideView(zoomControls);
      forceHideView(mapMenuControls);
      forceHideView(mapRoutePlanControl);
    }
    checkVisibilityAndDraw(showDefaultButtons, zoomControls, canvas, tileBox, nightMode);
    checkVisibilityAndDraw(showDefaultButtons, mapMenuControls, canvas, tileBox, nightMode);
    // show only on touch
    checkVisibilityAndDraw(false, mapRoutePlanControl, canvas, tileBox, nightMode);

    // route calculation buttons
    boolean showRouteCalculationControls = routePlanningMode;
    checkVisibilityAndDraw(
        showRouteCalculationControls, mapSmallMenuControls, canvas, tileBox, nightMode);
    checkVisibilityAndDraw(
        showRouteCalculationControls, mapCancelNavigationControl, canvas, tileBox, nightMode);
    checkVisibilityAndDraw(
        showRouteCalculationControls, mapInfoNavigationControl, canvas, tileBox, nightMode);
    checkVisibilityAndDraw(
        showRouteCalculationControls, mapAppModeControl, canvas, tileBox, nightMode);
    checkVisibilityAndDraw(
        showRouteCalculationControls, mapNavigationControl, canvas, tileBox, nightMode);
    checkVisibilityAndDraw(
        showRouteCalculationControls, zoomSideControls, canvas, tileBox, nightMode);

    // the last one to check other controls visibility
    int vmargin =
        mapNavigationControl.isVisible() || zoomControls.isVisible() ? zoomControls.getHeight() : 0;
    rulerControl.setVerticalMargin(vmargin);
    checkVisibilityAndDraw(true, rulerControl, canvas, tileBox, nightMode);
  }
 @Override
 public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) {
   if (!mapActivity.getRoutingHelper().isRoutePlanningMode()
       && mapActivity.getRoutingHelper().isFollowingMode()) {
     if (!settings.SHOW_ZOOM_BUTTONS_NAVIGATION.get()) {
       zoomControls.showWithDelay(
           (FrameLayout) mapActivity.getMapView().getParent(), TIMEOUT_TO_SHOW_BUTTONS);
       mapMenuControls.showWithDelay(
           (FrameLayout) mapActivity.getMapView().getParent(), TIMEOUT_TO_SHOW_BUTTONS);
     }
     mapRoutePlanControl.showWithDelay(
         (FrameLayout) mapActivity.getMapView().getParent(), TIMEOUT_TO_SHOW_BUTTONS);
   }
   for (MapControls m : allControls) {
     if (m.isVisible() && m.onTouchEvent(event, tileBox)) {
       return true;
     }
   }
   return false;
 }