From c738deab237591ba764258bdd30e32d6736adf4f Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Wed, 6 Jan 2021 17:06:27 +0100 Subject: [PATCH] commentssssssssssssssssssssss --- .../com/a1/nextlocation/fragments/HomeFragment.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java b/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java index 4e45cc5..3080567 100644 --- a/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java +++ b/app/src/main/java/com/a1/nextlocation/fragments/HomeFragment.java @@ -52,13 +52,14 @@ import java.util.List; public class HomeFragment extends Fragment implements LocationListener { private final String userAgent = "com.ai.nextlocation.fragments"; - public final static String MAPQUEST_API_KEY = "vuyXjqnAADpjeL9QwtgWGleIk95e36My"; + private ImageButton imageButton; private ImageButton stopButton; private MapView mapView; + private final int REQUEST_PERMISSIONS_REQUEST_CODE = 1; private final String TAG = HomeFragment.class.getCanonicalName(); - // private RoadManager roadManager; + private Polyline roadOverlay; private int color; private Location currentLocation; @@ -95,11 +96,14 @@ public class HomeFragment extends Fragment implements LocationListener { stopRoute(); }); + // show or hide the stop route button based on if we are following a route if (RouteHandler.INSTANCE.isFollowingRoute()) { stopButton.setVisibility(View.VISIBLE); } else { stopButton.setVisibility(View.GONE); } + + //register as a listener for a result of the API ApiHandler.INSTANCE.addListener(this::onDirectionsAvailable); return view; } @@ -108,7 +112,7 @@ public class HomeFragment extends Fragment implements LocationListener { * stops the current route */ private void stopRoute() { - Log.e(TAG, "stopRoute: STOPPING ROUTE" ); + Log.d(TAG, "stopRoute: STOPPING ROUTE" ); RouteHandler.INSTANCE.finishRoute(); stopButton.setVisibility(View.GONE); Toast.makeText(requireContext(), getResources().getString(R.string.route_stop_toast), Toast.LENGTH_SHORT).show(); @@ -131,7 +135,7 @@ public class HomeFragment extends Fragment implements LocationListener { roadOverlay.setPoints(geoPoints); roadOverlay.setColor(color); - + // pass the line to the route handler RouteHandler.INSTANCE.setCurrentRouteLine(roadOverlay); Log.d(TAG, "onDirectionsAvailable: successfully added road!");