Ejemplo 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();
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
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();
  }
Ejemplo n.º 4
0
 public void prepare(@Nullable MapObject endPoint) {
   prepare(LocationHelper.INSTANCE.getMyPosition(), endPoint);
 }