Exemplo n.º 1
0
  public void start() {
    mLogger.d("start");

    if (!MapObject.isOfType(MapObject.MY_POSITION, mStartPoint)) {
      Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_START_SUGGEST_REBUILD);
      AlohaHelper.logClick(AlohaHelper.ROUTING_START_SUGGEST_REBUILD);
      suggestRebuildRoute();
      return;
    }

    MapObject my = LocationHelper.INSTANCE.getMyPosition();
    if (my == null) {
      mRoutingListener.onRoutingEvent(ResultCodesHelper.NO_POSITION, null);
      return;
    }

    mStartPoint = my;
    Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_START);
    AlohaHelper.logClick(AlohaHelper.ROUTING_START);
    setState(State.NAVIGATION);

    mContainer.showRoutePlan(false, null);
    mContainer.showNavigation(true);

    ThemeSwitcher.restart();

    Framework.nativeFollowRoute();
    LocationHelper.INSTANCE.restart();
  }
Exemplo n.º 2
0
 void setDistance(Bookmark bmk) {
   final Location loc = LocationHelper.INSTANCE.getSavedLocation();
   if (loc != null) {
     final DistanceAndAzimut daa =
         bmk.getDistanceAndAzimuth(loc.getLatitude(), loc.getLongitude(), 0.0);
     distance.setText(daa.getDistance());
   } else distance.setText(null);
 }
Exemplo n.º 3
0
  private boolean setStartFromMyPosition() {
    mLogger.d("setStartFromMyPosition");

    MapObject my = LocationHelper.INSTANCE.getMyPosition();
    if (my == null) {
      mLogger.d("setStartFromMyPosition: no my position - skip");

      if (mContainer != null) mContainer.updatePoints();

      setPointsInternal();
      return false;
    }

    return setStartPoint(my);
  }
Exemplo n.º 4
0
  private void cancelInternal() {
    mLogger.d("cancelInternal");

    mStartPoint = null;
    mEndPoint = null;
    setPointsInternal();
    mWaitingPoiPickSlot = NO_SLOT;
    mUberRequestHandled = false;

    setBuildState(BuildState.NONE);
    setState(State.NONE);

    ThemeSwitcher.restart();
    Framework.nativeCloseRouting();
    LocationHelper.INSTANCE.restart();
  }
Exemplo n.º 5
0
 private void updatePedestrian(RoutingInfo info) {
   Location next = info.pedestrianNextDirection;
   Location location = LocationHelper.INSTANCE.getLastLocation();
   DistanceAndAzimut da =
       Framework.nativeGetDistanceAndAzimutFromLatLon(
           next.getLatitude(),
           next.getLongitude(),
           location.getLatitude(),
           location.getLongitude(),
           mNorth);
   String[] splitDistance = da.getDistance().split(" ");
   mDistanceTurn.setText(
       Utils.formatUnitsText(
           R.dimen.text_size_display_1,
           R.dimen.text_size_toolbar,
           splitDistance[0],
           splitDistance[1]));
   if (info.pedestrianTurnDirection != null)
     info.pedestrianTurnDirection.setTurnDrawable(mTurnDirection, da);
 }
Exemplo n.º 6
0
  private void suggestRebuildRoute() {
    final AlertDialog.Builder builder =
        new AlertDialog.Builder(mContainer.getActivity())
            .setMessage(R.string.p2p_reroute_from_current)
            .setCancelable(false)
            .setNegativeButton(R.string.cancel, null);

    TextView titleView =
        (TextView)
            View.inflate(mContainer.getActivity(), R.layout.dialog_suggest_reroute_title, null);
    titleView.setText(R.string.p2p_only_from_current);
    builder.setCustomTitle(titleView);

    if (MapObject.isOfType(MapObject.MY_POSITION, mEndPoint)) {
      builder.setPositiveButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              swapPoints();
            }
          });
    } else {
      if (LocationHelper.INSTANCE.getMyPosition() == null)
        builder.setMessage(null).setNegativeButton(null, null);

      builder.setPositiveButton(
          R.string.ok,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              setStartFromMyPosition();
            }
          });
    }

    builder.show();
  }
Exemplo n.º 7
0
 public void stopLocationUpdate() {
   LocationHelper.INSTANCE.removeListener(mLocationListener);
 }
Exemplo n.º 8
0
 public void startLocationUpdate() {
   LocationHelper.INSTANCE.addListener(mLocationListener, true);
 }
Exemplo n.º 9
0
 public void prepare(@Nullable MapObject endPoint) {
   prepare(LocationHelper.INSTANCE.getMyPosition(), endPoint);
 }