use of net.osmand.plus.auto.NavigationSession in project Osmand by osmandapp.
the class DestinationReachedMenu method show.
public static void show(MapActivity mapActivity) {
if (!DestinationReachedMenuFragment.isExists()) {
shown = true;
NavigationSession carNavigationSession = mapActivity.getMyApplication().getCarNavigationSession();
if (carNavigationSession == null || !carNavigationSession.hasStarted()) {
DestinationReachedMenu menu = new DestinationReachedMenu(mapActivity);
DestinationReachedMenuFragment.showInstance(menu);
}
}
}
use of net.osmand.plus.auto.NavigationSession in project Osmand by osmandapp.
the class NavigationService method updateCarNavigation.
public void updateCarNavigation() {
OsmandApplication app = getApp();
RoutingHelper routingHelper = app.getRoutingHelper();
TripHelper tripHelper = this.tripHelper;
if (carNavigationActive && tripHelper != null && routingHelper.isRouteCalculated() && routingHelper.isFollowingMode()) {
NavigationSession carNavigationSession = app.getCarNavigationSession();
if (carNavigationSession != null) {
NavigationScreen navigationScreen = carNavigationSession.getNavigationScreen();
if (navigationScreen != null) {
float density = navigationScreen.getSurfaceRenderer().getDensity();
if (density == 0) {
density = 1;
}
Trip trip = tripHelper.buildTrip(density);
navigationManager.updateTrip(trip);
List<Destination> destinations = null;
Destination destination = tripHelper.getLastDestination();
TravelEstimate destinationTravelEstimate = tripHelper.getLastDestinationTravelEstimate();
if (destination != null) {
destinations = Collections.singletonList(destination);
}
TravelEstimate lastStepTravelEstimate = tripHelper.getLastStepTravelEstimate();
navigationScreen.updateTrip(true, routingHelper.isRouteBeingCalculated(), false, /*routingHelper.isRouteWasFinished()*/
destinations, trip.getSteps(), destinationTravelEstimate, lastStepTravelEstimate != null ? lastStepTravelEstimate.getRemainingDistance() : null, false, true, null);
}
}
}
}
use of net.osmand.plus.auto.NavigationSession in project Osmand by osmandapp.
the class OsmandApplication method showToastMessage.
public void showToastMessage(final int msgId, final Object... args) {
uiHandler.post(() -> {
Toast.makeText(OsmandApplication.this, getString(msgId, args), Toast.LENGTH_LONG).show();
NavigationSession carNavigationSession = this.carNavigationSession;
if (carNavigationSession != null && carNavigationSession.hasStarted()) {
CarToast.makeText(carNavigationSession.getCarContext(), getString(msgId, args), CarToast.LENGTH_LONG).show();
}
});
}
use of net.osmand.plus.auto.NavigationSession in project Osmand by osmandapp.
the class OsmandApplication method showToastMessage.
public void showToastMessage(final String msg) {
uiHandler.post(() -> {
Toast.makeText(OsmandApplication.this, msg, Toast.LENGTH_LONG).show();
NavigationSession carNavigationSession = this.carNavigationSession;
if (carNavigationSession != null && carNavigationSession.hasStarted()) {
CarToast.makeText(carNavigationSession.getCarContext(), msg, CarToast.LENGTH_LONG).show();
}
});
}
use of net.osmand.plus.auto.NavigationSession in project Osmand by osmandapp.
the class OsmandApplication method showShortToastMessage.
public void showShortToastMessage(final int msgId, final Object... args) {
uiHandler.post(() -> {
Toast.makeText(OsmandApplication.this, getString(msgId, args), Toast.LENGTH_SHORT).show();
NavigationSession carNavigationSession = this.carNavigationSession;
if (carNavigationSession != null && carNavigationSession.hasStarted()) {
CarToast.makeText(carNavigationSession.getCarContext(), getString(msgId, args), CarToast.LENGTH_SHORT).show();
}
});
}
Aggregations