From cc3ef24a589685a7b341838b8d41700df00a0766 Mon Sep 17 00:00:00 2001 From: ajbruin Date: Thu, 16 Aug 2018 19:46:38 +0200 Subject: [PATCH] Negentwee: Support house numbers in addresses. --- enabler/src/de/schildbach/pte/NegentweeProvider.java | 8 ++++++++ .../de/schildbach/pte/live/NegentweeProviderLiveTest.java | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/enabler/src/de/schildbach/pte/NegentweeProvider.java b/enabler/src/de/schildbach/pte/NegentweeProvider.java index fdda1371..95783173 100644 --- a/enabler/src/de/schildbach/pte/NegentweeProvider.java +++ b/enabler/src/de/schildbach/pte/NegentweeProvider.java @@ -518,6 +518,14 @@ public class NegentweeProvider extends AbstractNetworkProvider { String locationType = location.getString("type"); String locationName = location.getString("name"); + + if (locationType.equals("address")) { + String houseNumber = location.optString("houseNr"); + if (!houseNumber.isEmpty()) { + locationName = locationName + " " + houseNumber; + } + } + if (addTypePrefix && !location.isNull(locationType + "Type") && !locationType.equals("poi")) { locationName = location.getString(locationType + "Type") + " " + locationName; } diff --git a/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java index 070c7ca9..bea501f1 100644 --- a/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/NegentweeProviderLiveTest.java @@ -99,6 +99,13 @@ public class NegentweeProviderLiveTest extends AbstractProviderLiveTest { assertEquals(SuggestLocationsResult.Status.OK, result.status); } + @Test + public void suggestLocationsAddress() throws Exception { + final SuggestLocationsResult result = suggestLocations("Isolatorweg 32"); + print(result); + assertEquals(SuggestLocationsResult.Status.OK, result.status); + } + @Test public void suggestLocationsIncomplete() throws Exception { final SuggestLocationsResult result = suggestLocations("Amsterdam");