[CHANGED] String values

This commit is contained in:
Robin Koedood
2021-01-06 12:08:25 +01:00
parent 525d4b776d
commit 0ed16ee069
15 changed files with 29 additions and 25 deletions

View File

@@ -28,6 +28,7 @@ import com.a1.nextlocation.R;
import com.a1.nextlocation.data.StaticData;
import com.a1.nextlocation.json.DirectionsResult;
import com.a1.nextlocation.network.ApiHandler;
import com.a1.nextlocation.network.DirectionsListener;
import com.a1.nextlocation.recyclerview.LocationListManager;
import org.osmdroid.api.IMapController;
@@ -46,7 +47,7 @@ import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
import java.util.ArrayList;
import java.util.List;
public class HomeFragment extends Fragment implements LocationListener{
public class HomeFragment extends Fragment implements LocationListener, DirectionsListener {
private final String userAgent = "com.ai.nextlocation.fragments";
public final static String MAPQUEST_API_KEY = "vuyXjqnAADpjeL9QwtgWGleIk95e36My";
private ImageButton imageButton;
@@ -84,11 +85,12 @@ public class HomeFragment extends Fragment implements LocationListener{
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, locationFragment).addToBackStack(null).commit();
});
ApiHandler.INSTANCE.addListener(this::onDirectionsAvailable);
ApiHandler.INSTANCE.addListener(this);
return view;
}
private void onDirectionsAvailable(DirectionsResult directionsResult) {
@Override
public void onDirectionsAvailable(DirectionsResult directionsResult) {
Log.d(TAG, "onDirectionsAvailable: got result! " + directionsResult);
ArrayList<GeoPoint> geoPoints = directionsResult.getGeoPoints();
roadOverlay = new Polyline();

View File

@@ -52,7 +52,7 @@ public enum ApiHandler {
if (response.body() != null) {
String responseString = Objects.requireNonNull(response.body()).string();
Log.d(TAG, "getDirections: got response: " + responseString);
System.out.println(responseString);
DirectionsResult result = new DirectionsResult();
result.parse(responseString);
Log.d(TAG, "getDirections: " + result.getSteps().size());