Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/r4.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
vshcherb committed Nov 20, 2024
2 parents 647f429 + a85aad4 commit 01f5273
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
15 changes: 9 additions & 6 deletions OsmAnd/src/net/osmand/plus/auto/NavigationSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void onStart(@NonNull LifecycleOwner owner) {
@Override
public void onResume(@NonNull LifecycleOwner owner) {
if (routingHelper.isFollowingMode() && routingHelper.isRouteCalculated()) {
startNavigation();
startNavigationScreen();
// updateCarNavigation(routingHelper.getLastFixedLocation());
} else {
showRoutePreview();
Expand Down Expand Up @@ -377,7 +377,7 @@ private void processNavigationIntent(@NonNull Uri uri) {
if (obj != null) {
getApp().getOsmandMap().getMapLayers().getMapActionsHelper().startNavigation();
if (hasStarted()) {
startNavigation();
startNavigationScreen();
}
}
});
Expand Down Expand Up @@ -419,7 +419,7 @@ public boolean requestLocationNavigation() {
return requestLocationPermission();
}

public void startNavigation() {
public void startNavigationScreen() {
if (navigationScreen != null) {
CarContext context = getCarContext();
ScreenManager screenManager = context.getCarService(ScreenManager.class);
Expand All @@ -432,8 +432,11 @@ public void startNavigation() {
navigationScreen = new NavigationScreen(getCarContext(), settingsAction, this);
navigationCarSurface.setCallback(navigationScreen);
}
startCarNavigation();
getCarContext().getCarService(ScreenManager.class).push(navigationScreen);
// navigation already started
if (routingHelper.isFollowingMode() && routingHelper.isRouteCalculated() && !carNavigationActive) {
startCarNavigation();
}
}


Expand Down Expand Up @@ -512,7 +515,7 @@ private void showRoutePreview() {
if (obj != null) {
app.getOsmandMap().getMapLayers().getMapActionsHelper().startNavigation();
if (hasStarted()) {
startNavigation();
startNavigationScreen();
}
}
});
Expand Down Expand Up @@ -674,7 +677,7 @@ public void updateCarNavigation(Location currentLocation) {
if (carNavigationSession != null) {
NavigationScreen navigationScreen = carNavigationSession.getNavigationScreen();
if (navigationScreen == null) {
carNavigationSession.startNavigation();
carNavigationSession.startNavigationScreen();
navigationScreen = carNavigationSession.getNavigationScreen();
}
if (navigationScreen != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class BaseAndroidAutoScreen(carContext: CarContext) : Screen(carContext
private fun startNavigation() {
app.osmandMap.mapLayers.mapActionsHelper.startNavigation()
val session = app.carNavigationSession
session?.startNavigation()
session?.startNavigationScreen()
}

protected fun createSearchAction() = Action.Builder()
Expand Down
5 changes: 1 addition & 4 deletions OsmAnd/src/net/osmand/plus/auto/screens/FavoritesScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import androidx.car.app.navigation.model.PlaceListNavigationTemplate;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.IconCompat;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;

import net.osmand.data.FavouritePoint;
Expand All @@ -31,8 +30,6 @@
import net.osmand.plus.auto.NavigationSession;
import net.osmand.plus.auto.TripUtils;
import net.osmand.plus.myplaces.favorites.FavoriteGroup;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.enums.CompassMode;
import net.osmand.plus.utils.AndroidUtils;
import net.osmand.plus.views.PointImageUtils;
import net.osmand.plus.views.layers.FavouritesLayer;
Expand Down Expand Up @@ -161,7 +158,7 @@ private void onRouteSelected(@NonNull SearchResult sr) {
getApp().getOsmandMap().getMapLayers().getMapActionsHelper().startNavigation();
NavigationSession session = getApp().getCarNavigationSession();
if (session != null && session.hasStarted()) {
session.startNavigation();
session.startNavigationScreen();
}
}

Expand Down
2 changes: 1 addition & 1 deletion OsmAnd/src/net/osmand/plus/auto/screens/LandingScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class LandingScreen(
if (app.routingHelper.isRouteCalculated) {
app.routingHelper.resumeNavigation()
}
carNavigationSession.startNavigation()
carNavigationSession.startNavigationScreen()
// duplicate code from startNavigation
// val navigationScreen = carNavigationSession.navigationScreen
// navigationScreen?.let {
Expand Down

0 comments on commit 01f5273

Please sign in to comment.