mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-07 18:58:48 +00:00
LocationView: When parsing Geocoder result, extract postal code too.
This commit is contained in:
parent
c87100498d
commit
0586301002
1 changed files with 9 additions and 5 deletions
|
@ -19,6 +19,7 @@ package de.schildbach.oeffi.directions;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import de.schildbach.oeffi.Constants;
|
import de.schildbach.oeffi.Constants;
|
||||||
|
@ -454,14 +455,17 @@ public class LocationView extends FrameLayout implements LocationHelper.Callback
|
||||||
|
|
||||||
final Location location;
|
final Location location;
|
||||||
final int maxAddressLineIndex = address.getMaxAddressLineIndex();
|
final int maxAddressLineIndex = address.getMaxAddressLineIndex();
|
||||||
if (maxAddressLineIndex >= 2 && Strings.emptyToNull(address.getAddressLine(2)) != null)
|
if (maxAddressLineIndex >= 2 && Strings.emptyToNull(address.getAddressLine(2)) != null) {
|
||||||
location = new Location(LocationType.ADDRESS, null, coord, address.getAddressLine(1),
|
location = new Location(LocationType.ADDRESS, null, coord, address.getAddressLine(1),
|
||||||
address.getAddressLine(0));
|
address.getAddressLine(0));
|
||||||
else if (address.getThoroughfare() != null)
|
} else if (address.getThoroughfare() != null) {
|
||||||
location = new Location(LocationType.ADDRESS, null, coord, address.getLocality(), address.getThoroughfare()
|
final Joiner joiner = Joiner.on(' ').skipNulls();
|
||||||
+ (address.getFeatureName() != null ? " " + address.getFeatureName() : ""));
|
location = new Location(LocationType.ADDRESS, null, coord,
|
||||||
else
|
joiner.join(address.getPostalCode(), address.getLocality()),
|
||||||
|
joiner.join(address.getThoroughfare(), address.getFeatureName()));
|
||||||
|
} else {
|
||||||
location = new Location(LocationType.ADDRESS, null, coord);
|
location = new Location(LocationType.ADDRESS, null, coord);
|
||||||
|
}
|
||||||
|
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue