From 4fe38d4cde0e0a8235cc132d673331c10ce140a4 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 9 Jun 2020 17:25:25 +0300 Subject: [PATCH 1/3] Fix vector drawable --- .../settings/bottomsheets/VehicleParametersBottomSheet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/VehicleParametersBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/VehicleParametersBottomSheet.java index 8700798c23..2e50c74ae0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/VehicleParametersBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/VehicleParametersBottomSheet.java @@ -57,8 +57,8 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet { VehicleSizeAssets vehicleSizeAssets = VehicleSizeAssets.getAssets(parameterName); if (vehicleSizeAssets != null) { ImageView imageView = mainView.findViewById(R.id.image_view); - imageView.setImageDrawable(ContextCompat.getDrawable(app, - !nightMode ? vehicleSizeAssets.getDayIconId() : vehicleSizeAssets.getNightIconId())); + imageView.setImageDrawable(app.getUIUtilities() + .getIcon(!nightMode ? vehicleSizeAssets.getDayIconId() : vehicleSizeAssets.getNightIconId())); TextView description = mainView.findViewById(R.id.description); description.setText(app.getString(vehicleSizeAssets.getDescriptionRes())); } From 40fd5667e5018c4c07236e63db82799695661cef Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 9 Jun 2020 19:09:45 +0200 Subject: [PATCH 2/3] Fix #9187 - add test --- .../net/osmand/CollatorStringMatcher.java | 21 +++++++++++++++---- .../main/java/net/osmand/OsmAndCollator.java | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java b/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java index bd1a208cfc..f5808961d7 100644 --- a/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java +++ b/OsmAnd-java/src/main/java/net/osmand/CollatorStringMatcher.java @@ -33,8 +33,9 @@ public class CollatorStringMatcher implements StringMatcher { public CollatorStringMatcher(String part, StringMatcherMode mode) { this.collator = OsmAndCollator.primaryCollator(); - this.part = part.toLowerCase(Locale.getDefault()); + this.part = simplifyStringAndAlignChars(part); this.mode = mode; + } public Collator getCollator() { @@ -123,14 +124,15 @@ public class CollatorStringMatcher implements StringMatcher { * @param theStart * @return true if searchIn starts with token */ - public static boolean cstartsWith(Collator collator, String fullText, String theStart, + public static boolean cstartsWith(Collator collator, String fullTextP, String theStart, boolean checkBeginning, boolean checkSpaces, boolean equals) { - String searchIn = fullText.toLowerCase(Locale.getDefault()); + String searchIn = simplifyStringAndAlignChars(fullTextP); int searchInLength = searchIn.length(); int startLength = theStart.length(); if (startLength == 0) { return true; } + // this is not correct because of Auhofstrasse != Auhofstraße if (startLength > searchInLength) { return false; } @@ -152,7 +154,8 @@ public class CollatorStringMatcher implements StringMatcher { if (isSpace(searchIn.charAt(i - 1)) && !isSpace(searchIn.charAt(i))) { if (collator.equals(searchIn.substring(i, i + startLength), theStart)) { if(equals) { - if(i + startLength == searchInLength || isSpace(searchIn.charAt(i + startLength))) { + if(i + startLength == searchInLength || + isSpace(searchIn.charAt(i + startLength))) { return true; } } else { @@ -168,7 +171,17 @@ public class CollatorStringMatcher implements StringMatcher { return false; } + private static String simplifyStringAndAlignChars(String fullText) { + int i; + fullText = fullText.toLowerCase(Locale.getDefault()); + while( (i = fullText.indexOf('ß') ) != -1 ) { + fullText = fullText.substring(0, i) + "ss" + fullText.substring(i+1); + } + return fullText; + } + private static boolean isSpace(char c){ return !Character.isLetter(c) && !Character.isDigit(c); } + } diff --git a/OsmAnd-java/src/main/java/net/osmand/OsmAndCollator.java b/OsmAnd-java/src/main/java/net/osmand/OsmAndCollator.java index bf8338f73a..21d0a5d231 100644 --- a/OsmAnd-java/src/main/java/net/osmand/OsmAndCollator.java +++ b/OsmAnd-java/src/main/java/net/osmand/OsmAndCollator.java @@ -38,4 +38,5 @@ public class OsmAndCollator { } }; } + } From aa610f424d69b0daf3f5062b0b67718d44017dff Mon Sep 17 00:00:00 2001 From: Hardy Date: Tue, 9 Jun 2020 19:56:07 +0200 Subject: [PATCH 3/3] string improvements --- OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java index 1c328f8343..b22717e079 100644 --- a/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java @@ -235,7 +235,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity { addButton(ll, "\u25BA (10.3) You have been off the route for 1050m", builder(p).offRoute(1050)); addButton(ll, "\u25BA (10.4) You are back on the route", builder(p).backOnRoute()); - addButton(ll, "Voice system info:", builder(p)); + addButton(ll, "System info and settings:", builder(p)); addButton(ll, "\u25BA (11.1) (TAP TO FULLY POPULATE)\n" + getVoiceSystemInfo(), builder(p).attention("")); addButton(ll, "\u25BA (11.2) (TAP TO CHANGE)\n \u25CF Voice prompt delay for selected output: " + ((OsmandApplication) getApplication()).getSettings().VOICE_PROMPT_DELAY[((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get()].get() + @@ -294,7 +294,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity { public void onClick(View v) { builder.play(); if (description.startsWith("\u25BA (11.1)")) { - buttonInfo.setText("\u25BA (11.1) Info detected:\n" + getVoiceSystemInfo()); + buttonInfo.setText("\u25BA (11.1) Voice system info:\n" + getVoiceSystemInfo()); // Toast.makeText(TestVoiceActivity.this, "Info refreshed.", Toast.LENGTH_LONG).show(); } if (description.startsWith("\u25BA (11.2)")) {