Skip to content

Commit

Permalink
Merge branch 'osmandapp:master' into hardy_Afa
Browse files Browse the repository at this point in the history
  • Loading branch information
sonora authored Jan 10, 2025
2 parents 90fb57c + 70ece52 commit f5fd2ec
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
33 changes: 17 additions & 16 deletions OsmAnd/res/layout/search_advanced_coords.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@
</LinearLayout>

<LinearLayout
android:id="@+id/northingLayout"
android:id="@+id/eastingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:visibility="gone">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/northingImage"
android:id="@+id/eastingImage"
android:layout_width="54dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_action_coordinates_latitude"/>
app:srcCompat="@drawable/ic_action_coordinates_longitude"/>

<FrameLayout
android:layout_width="match_parent"
Expand All @@ -245,47 +245,48 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp">
android:layout_marginEnd="16dp">

<EditText
android:id="@+id/northingEditText"
android:id="@+id/eastingEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/navigate_point_northing"
android:imeOptions="actionNext"
android:hint="@string/navigate_point_easting"
android:imeOptions="actionDone"
android:inputType="textCapCharacters|textNoSuggestions"
tools:text="22.12345"/>

</com.google.android.material.textfield.TextInputLayout>

<ImageButton
android:id="@+id/northingClearButton"
android:id="@+id/eastingClearButton"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="end"
android:layout_marginRight="4dp"
android:contentDescription="@string/shared_string_clear"
app:srcCompat="@drawable/ic_action_remove_dark"
android:layout_marginEnd="4dp" />
android:layout_marginEnd="4dp" />

</FrameLayout>

</LinearLayout>


<LinearLayout
android:id="@+id/eastingLayout"
android:id="@+id/northingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:visibility="gone">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/eastingImage"
android:id="@+id/northingImage"
android:layout_width="54dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_action_coordinates_longitude"/>
app:srcCompat="@drawable/ic_action_coordinates_latitude"/>

<FrameLayout
android:layout_width="match_parent"
Expand All @@ -298,18 +299,18 @@
android:layout_marginEnd="16dp">

<EditText
android:id="@+id/eastingEditText"
android:id="@+id/northingEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/navigate_point_easting"
android:imeOptions="actionDone"
android:hint="@string/navigate_point_northing"
android:imeOptions="actionNext"
android:inputType="textCapCharacters|textNoSuggestions"
tools:text="22.12345"/>

</com.google.android.material.textfield.TextInputLayout>

<ImageButton
android:id="@+id/eastingClearButton"
android:id="@+id/northingClearButton"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="48dp"
android:layout_height="48dp"
Expand Down
33 changes: 15 additions & 18 deletions OsmAnd/src/net/osmand/plus/auto/NavigationSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,8 @@
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.auto.screens.LandingScreen;
import net.osmand.plus.auto.screens.NavigationScreen;
import net.osmand.plus.auto.screens.RequestPermissionScreen;
import net.osmand.plus.auto.screens.*;
import net.osmand.plus.auto.screens.RequestPermissionScreen.LocationPermissionCheckCallback;
import net.osmand.plus.auto.screens.RequestPurchaseScreen;
import net.osmand.plus.auto.screens.RoutePreviewScreen;
import net.osmand.plus.auto.screens.SearchResultsScreen;
import net.osmand.plus.auto.screens.SettingsScreen;
import net.osmand.plus.helpers.LocationCallback;
import net.osmand.plus.helpers.LocationServiceHelper;
import net.osmand.plus.helpers.RestoreNavigationHelper;
Expand Down Expand Up @@ -121,7 +115,7 @@ public class NavigationSession extends Session implements NavigationListener, Os
Action settingsAction;

private OsmandMapTileView mapView;
private ApplicationMode defaultAppMode;
private ApplicationMode originalAppMode;

private OsmAndLocationProvider locationProvider;
private LocationServiceHelper locationServiceHelper;
Expand Down Expand Up @@ -190,12 +184,13 @@ public void onCreate(@NonNull LifecycleOwner owner) {
public void onStart(@NonNull LifecycleOwner owner) {
OsmandApplication app = getApp();
routingHelper.addListener(this);
defaultAppMode = settings.getApplicationMode();
if (!isAppModeDerivedFromCar(defaultAppMode)) {
List<ApplicationMode> availableAppModes = ApplicationMode.values(app);
for (ApplicationMode availableAppMode : availableAppModes) {
if (isAppModeDerivedFromCar(availableAppMode)) {
settings.setApplicationMode(availableAppMode, false);

ApplicationMode appMode = settings.getApplicationMode();
if (!isAppModeDerivedFromCar(appMode)) {
for (ApplicationMode mode : ApplicationMode.values(app)) {
if (isAppModeDerivedFromCar(mode)) {
originalAppMode = appMode;
settings.setApplicationMode(mode, false);
break;
}
}
Expand Down Expand Up @@ -227,11 +222,13 @@ public void onStop(@NonNull LifecycleOwner owner) {
OsmandApplication app = getApp();
routingHelper.removeListener(this);
settings.setLastKnownMapElevation(app.getOsmandMap().getMapView().getElevationAngle());
boolean routing = settings.FOLLOW_THE_ROUTE.get() || routingHelper.isRouteCalculated() || routingHelper.isRouteBeingCalculated();
if (defaultAppMode != null && !routing) {
settings.setApplicationMode(defaultAppMode);

boolean routing = settings.FOLLOW_THE_ROUTE.get() || routingHelper.isRouteCalculated()
|| routingHelper.isRouteBeingCalculated();
if (originalAppMode != null && !routing) {
settings.setApplicationMode(originalAppMode);
}
defaultAppMode = null;
originalAppMode = null;

app.getOsmandMap().getMapView().setupRenderingView();
app.onCarNavigationSessionStop(this);
Expand Down

0 comments on commit f5fd2ec

Please sign in to comment.