Example #1
0
 @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;
 }
Example #2
0
  @Override
  public void initLayer(final OsmandMapTileView view) {
    scaleCoefficient = view.getScaleCoefficient();
    FrameLayout parent = (FrameLayout) view.getParent();
    Handler showUIHandler = new Handler();
    int rightGravity = Gravity.RIGHT | Gravity.BOTTOM;
    int leftGravity = Gravity.LEFT | Gravity.BOTTOM;
    int rightCenterGravity = Gravity.RIGHT | Gravity.CENTER;

    // default buttons
    zoomControls =
        init(
            new MapZoomControls(mapActivity, showUIHandler, scaleCoefficient),
            parent,
            rightGravity);
    zoomSideControls =
        init(
            new MapZoomControls(mapActivity, showUIHandler, scaleCoefficient),
            parent,
            rightCenterGravity);
    mapMenuControls =
        init(
            new MapMenuControls(mapActivity, showUIHandler, scaleCoefficient), parent, leftGravity);
    mapRoutePlanControl =
        init(
            new MapRoutePlanControl(mapActivity, showUIHandler, scaleCoefficient),
            parent,
            leftGravity);
    // calculate route buttons
    mapSmallMenuControls =
        init(
            new SmallMapMenuControls(mapActivity, showUIHandler, scaleCoefficient),
            parent,
            leftGravity);
    mapCancelNavigationControl =
        init(
            new MapCancelControl(mapActivity, showUIHandler, scaleCoefficient),
            parent,
            leftGravity);
    mapInfoNavigationControl =
        init(
            new MapRouteInfoControl(
                mapActivity.getMapLayers().getContextMenuLayer(),
                mapActivity,
                showUIHandler,
                scaleCoefficient),
            parent,
            leftGravity);
    mapNavigationControl =
        init(
            new MapNavigateControl(
                mapInfoNavigationControl, mapActivity, showUIHandler, scaleCoefficient),
            parent,
            rightGravity);
    mapAppModeControl =
        init(
            new MapRoutePreferencesControl(mapActivity, showUIHandler, scaleCoefficient),
            parent,
            rightGravity);

    rulerControl =
        init(
            new RulerControl(zoomControls, mapActivity, showUIHandler, scaleCoefficient),
            parent,
            rightGravity);
    mapRoutePlanControl.setMargin(mapMenuControls.getWidth());
    mapCancelNavigationControl.setMargin(mapSmallMenuControls.getWidth());
    mapInfoNavigationControl.setMargin(
        mapSmallMenuControls.getWidth() + mapCancelNavigationControl.getWidth());
    mapAppModeControl.setMargin(mapNavigationControl.getWidth());

    initTransparencyBar(view, parent);
  }