/** * Sets ending point. * * <ul> * <li>If {@code point} is the same as starting point — swap points if ending point is * set, skip otherwise. * <li>Set starting point to MyPosition if it was not set before. * </ul> * * Route starts to build if both points were set. * * @return {@code true} if the point was set. */ @SuppressWarnings("Duplicates") public boolean setEndPoint(MapObject point) { mLogger.d("setEndPoint"); if (MapObject.same(mEndPoint, point)) { if (mStartPoint == null) return setStartFromMyPosition(); mLogger.d("setEndPoint: skip the same end point"); return false; } if (point != null && point.sameAs(mStartPoint)) { if (mEndPoint == null) { mLogger.d("setEndPoint: skip because end point is empty"); return false; } mLogger.d("setEndPoint: swap with starting point"); mStartPoint = mEndPoint; } mEndPoint = point; if (mStartPoint == null) return setStartFromMyPosition(); setPointsInternal(); checkAndBuildRoute(); return true; }
void swapPoints() { mLogger.d("swapPoints"); MapObject point = mStartPoint; mStartPoint = mEndPoint; mEndPoint = point; Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_SWAP_POINTS); AlohaHelper.logClick(AlohaHelper.ROUTING_SWAP_POINTS); setPointsInternal(); checkAndBuildRoute(); }
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); }
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(); }