Merge pull request #605 from afischerdev/new-apk

Update the APK for multiple issues
This commit is contained in:
afischerdev 2023-08-17 13:02:32 +02:00 committed by GitHub
commit 790152770f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 21 deletions

View file

@ -250,9 +250,11 @@ public final class VoiceHintProcessor {
if (input.cmd == VoiceHint.C && !input.goodWay.isLinktType()) { if (input.cmd == VoiceHint.C && !input.goodWay.isLinktType()) {
int badWayPrio = 0; int badWayPrio = 0;
if (input.badWays != null) {
for (MessageData md : input.badWays) { for (MessageData md : input.badWays) {
badWayPrio = Math.max(badWayPrio, md.getPrio()); badWayPrio = Math.max(badWayPrio, md.getPrio());
} }
}
if (input.goodWay.getPrio() < badWayPrio) { if (input.goodWay.getPrio() < badWayPrio) {
results.add(input); results.add(input);
} else { } else {

View file

@ -588,7 +588,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
} }
value = String.format(Locale.US, "%3.1f", foot * 0.3048f); value = String.format(Locale.US, "%3.1f", foot * 0.3048f);
} }
if (value.toLowerCase().contains("'")) { if (value.contains("'")) {
float foot = 0f; float foot = 0f;
int inch = 0; int inch = 0;
String[] sa = value.toLowerCase().trim().split("'"); String[] sa = value.toLowerCase().trim().split("'");
@ -601,9 +601,9 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
foot += inch / 12f; foot += inch / 12f;
} }
value = String.format(Locale.US, "%3.1f", foot * 0.3048f); value = String.format(Locale.US, "%3.1f", foot * 0.3048f);
} else if (value.contains("in") || value.contains("\"")) { } else if (value.toLowerCase().contains("in") || value.contains("\"")) {
float inch = 0f; float inch = 0f;
if (value.indexOf("in") > 0) value = value.substring(0, value.indexOf("in")); if (value.toLowerCase().indexOf("in") > 0) value = value.substring(0, value.toLowerCase().indexOf("in"));
if (value.indexOf("\"") > 0) value = value.substring(0, value.indexOf("\"")); if (value.indexOf("\"") > 0) value = value.substring(0, value.indexOf("\""));
inch = Float.parseFloat(value.trim()); inch = Float.parseFloat(value.trim());
value = String.format(Locale.US, "%3.1f", inch * 0.0254f); value = String.format(Locale.US, "%3.1f", inch * 0.0254f);
@ -613,20 +613,18 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
feet = Float.parseFloat(s.trim()); feet = Float.parseFloat(s.trim());
value = String.format(Locale.US, "%3.1f", feet * 0.3048f); value = String.format(Locale.US, "%3.1f", feet * 0.3048f);
} else if (value.toLowerCase().contains("fathom") || value.toLowerCase().contains("fm")) { } else if (value.toLowerCase().contains("fathom") || value.toLowerCase().contains("fm")) {
float fathom = 0f;
String s = value.substring(0, value.toLowerCase().indexOf("f")); String s = value.substring(0, value.toLowerCase().indexOf("f"));
fathom = Float.parseFloat(s.trim()); float fathom = Float.parseFloat(s.trim());
value = String.format(Locale.US, "%3.1f", fathom * 1.8288f); value = String.format(Locale.US, "%3.1f", fathom * 1.8288f);
} else if (value.contains("cm")) { } else if (value.toLowerCase().contains("cm")) {
String[] sa = value.trim().split("cm"); String[] sa = value.toLowerCase().trim().split("cm");
if (sa.length == 1) value = sa[0].trim(); if (sa.length >= 1) value = sa[0].trim();
float cm = Float.parseFloat(value.trim()); float cm = Float.parseFloat(value.trim());
value = String.format(Locale.US, "%3.1f", cm * 100f); value = String.format(Locale.US, "%3.1f", cm / 100f);
} else if (value.toLowerCase().contains("meter")) { } else if (value.toLowerCase().contains("meter")) {
String s = value.substring(0, value.toLowerCase().indexOf("m")); String s = value.substring(0, value.toLowerCase().indexOf("m"));
value = s.trim(); value = s.trim();
} else if (value.toLowerCase().contains("mph")) { } else if (value.toLowerCase().contains("mph")) {
value = value.replace("_", "");
String[] sa = value.trim().toLowerCase().split("mph"); String[] sa = value.trim().toLowerCase().split("mph");
if (sa.length >= 1) value = sa[0].trim(); if (sa.length >= 1) value = sa[0].trim();
float mph = Float.parseFloat(value.trim()); float mph = Float.parseFloat(value.trim());
@ -636,10 +634,10 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
if (sa.length >= 1) value = sa[0].trim(); if (sa.length >= 1) value = sa[0].trim();
float nm = Float.parseFloat(value.trim()); float nm = Float.parseFloat(value.trim());
value = String.format(Locale.US, "%3.1f", nm * 1.852f); value = String.format(Locale.US, "%3.1f", nm * 1.852f);
} else if (value.contains("kmh") || value.contains("km/h") || value.contains("kph")) { } else if (value.toLowerCase().contains("kmh") || value.toLowerCase().contains("km/h") || value.toLowerCase().contains("kph")) {
String[] sa = value.trim().split("k"); String[] sa = value.toLowerCase().trim().split("k");
if (sa.length == 1) value = sa[0].trim(); if (sa.length > 1) value = sa[0].trim();
} else if (value.contains("m")) { } else if (value.toLowerCase().contains("m")) {
String s = value.substring(0, value.toLowerCase().indexOf("m")); String s = value.substring(0, value.toLowerCase().indexOf("m"));
value = s.trim(); value = s.trim();
} else if (value.contains("(")) { } else if (value.contains("(")) {

View file

@ -92,6 +92,7 @@
android:name=".RoutingParameterDialog" android:name=".RoutingParameterDialog"
android:exported="true" android:exported="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:configChanges="orientation|screenSize|keyboardHidden"
/> />
<service <service

View file

@ -10,6 +10,7 @@ interface IBRouterService {
// "maxRunningTime"-->String with a number of seconds for the routing timeout, default = 60 // "maxRunningTime"-->String with a number of seconds for the routing timeout, default = 60
// "turnInstructionFormat"-->String selecting the format for turn-instructions values: osmand, locus // "turnInstructionFormat"-->String selecting the format for turn-instructions values: osmand, locus
// "trackFormat"-->[kml|gpx|json] default = gpx // "trackFormat"-->[kml|gpx|json] default = gpx
// "acceptCompressedResult"-->[true] sends a compressed result when output format is gpx
// "lats"-->double[] array of latitudes; 2 values at least. // "lats"-->double[] array of latitudes; 2 values at least.
// "lons"-->double[] array of longitudes; 2 values at least. // "lons"-->double[] array of longitudes; 2 values at least.
// "nogoLats"-->double[] array of nogo latitudes; may be null. // "nogoLats"-->double[] array of nogo latitudes; may be null.

View file

@ -845,8 +845,13 @@ public class BRouterView extends View {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (checkedModes[i]) { if (checkedModes[i]) {
writeRawTrackToMode(routingModes[i]); writeRawTrackToMode(routingModes[i]);
String s = map.get(routingModes[i]).params; ServiceModeConfig sm = map.get(routingModes[i]);
String p = map.get(routingModes[i]).profile; String s = null;
String p = null;
if (sm != null) {
s = sm.params;
p = sm.profile;
}
if (s == null || !p.equals(profileName)) s = "noparams"; if (s == null || !p.equals(profileName)) s = "noparams";
ServiceModeConfig smc = new ServiceModeConfig(routingModes[i], profileName, s); ServiceModeConfig smc = new ServiceModeConfig(routingModes[i], profileName, s);
for (OsmNodeNamed nogo : nogoVetoList) { for (OsmNodeNamed nogo : nogoVetoList) {

View file

@ -64,7 +64,7 @@ public class BRouterWorker {
if ("osmand".equalsIgnoreCase(tiFormat)) { if ("osmand".equalsIgnoreCase(tiFormat)) {
rc.turnInstructionMode = 3; rc.turnInstructionMode = 3;
} else if ("locus".equalsIgnoreCase(tiFormat)) { } else if ("locus".equalsIgnoreCase(tiFormat)) {
rc.turnInstructionMode = 7; rc.turnInstructionMode = 2;
} }
} }
if (params.containsKey("timode")) { if (params.containsKey("timode")) {

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.window.OnBackInvokedCallback; import android.window.OnBackInvokedCallback;
@ -202,6 +203,11 @@ public class RoutingParameterDialog extends AppCompatActivity {
} }
} }
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
public static class MyPreferenceFragment extends PreferenceFragmentCompat { public static class MyPreferenceFragment extends PreferenceFragmentCompat {

View file

@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/> <background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/> <foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

View file

@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/> <background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/> <foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>