added visualizing route

This commit is contained in:
Sem van der Hoeven
2021-01-05 11:25:13 +01:00
parent bcd9eb6378
commit e8af38981f
7 changed files with 134 additions and 31 deletions

View File

@@ -38,7 +38,7 @@ public enum ApiHandler {
}
public void getDirections(double startLat, double startLong, double endLat, double endLong) {
getDirections(startLat + "," + startLong, endLat + "," + endLong);
getDirections(startLong + "," + startLat, endLong + "," + endLat);
}
public void getDirections(String startLocation, String endLocation) {
@@ -69,6 +69,12 @@ public enum ApiHandler {
t.start();
// try {
// t.join();
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
public void addListener(DirectionsListener listener) {
@@ -104,6 +110,10 @@ public enum ApiHandler {
if (response.body() != null) {
String responseString = Objects.requireNonNull(response.body()).string();
Log.d(TAG, "getDirections: got response: " + responseString);
if (responseString.startsWith("{\"error")) {
Log.e(TAG, "getDirections: ERROR IN REQUEST!");
return;
}
DirectionsResult result = new DirectionsResult();
result.parseRoute(responseString);
@@ -121,6 +131,12 @@ public enum ApiHandler {
t.start();
// try {
// t.join();
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}