Improve formatStreetName
This commit is contained in:
parent
39c67ae8ff
commit
c928c89209
1 changed files with 42 additions and 15 deletions
|
@ -710,22 +710,49 @@ public class RoutingHelper {
|
||||||
|
|
||||||
|
|
||||||
public static String formatStreetName(String name, String ref, String destination) {
|
public static String formatStreetName(String name, String ref, String destination) {
|
||||||
if(destination != null && destination.length() > 0){
|
//Original version returned:
|
||||||
if(ref != null && ref.length() > 0) {
|
// 1. ref + " " + dest
|
||||||
destination = ref + " " + destination;
|
// 2. dest
|
||||||
}
|
// 3. ref + " " + name
|
||||||
return destination;
|
// 4. name
|
||||||
} else if(name != null && name.length() > 0){
|
// 5. ref
|
||||||
if(ref != null && ref.length() > 0) {
|
// 6. ""
|
||||||
name = ref + " " + name;
|
//Now returns: (ref)+((" ")+name)+((" ")+"toward "+dest)
|
||||||
}
|
|
||||||
return name;
|
String formattedStreetName = "";
|
||||||
} else {
|
if (ref != null && ref.length() > 0) {
|
||||||
if(ref == null) {
|
formattedStreetName = ref;
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return ref;
|
|
||||||
}
|
}
|
||||||
|
if (name != null && name.length() > 0) {
|
||||||
|
if (formattedStreetName.length() > 0) {
|
||||||
|
formattedStreetName = formattedStreetName + " ";
|
||||||
|
}
|
||||||
|
formattedStreetName = formattedStreetName + name;
|
||||||
|
}
|
||||||
|
if (destination != null && destination.length() > 0) {
|
||||||
|
if (formattedStreetName.length() > 0) {
|
||||||
|
formattedStreetName = formattedStreetName + " ";
|
||||||
|
}
|
||||||
|
formattedStreetName = formattedStreetName + app.getString(R.string.towards) + " " + destination;
|
||||||
|
}
|
||||||
|
return formattedStreetName;
|
||||||
|
|
||||||
|
// if(destination != null && destination.length() > 0){
|
||||||
|
// if(ref != null && ref.length() > 0) {
|
||||||
|
// destination = ref + " " + destination;
|
||||||
|
// }
|
||||||
|
// return destination;
|
||||||
|
// } else if(name != null && name.length() > 0){
|
||||||
|
// if(ref != null && ref.length() > 0) {
|
||||||
|
// name = ref + " " + name;
|
||||||
|
// }
|
||||||
|
// return name;
|
||||||
|
// } else {
|
||||||
|
// if(ref == null) {
|
||||||
|
// return "";
|
||||||
|
// }
|
||||||
|
// return ref;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, float defSpeed){
|
// protected boolean isDistanceLess(float currentSpeed, double dist, double etalon, float defSpeed){
|
||||||
|
|
Loading…
Reference in a new issue