added locations to map

This commit is contained in:
Sem van der Hoeven
2021-01-05 13:43:10 +01:00
22 changed files with 166 additions and 137 deletions

View File

@@ -3,14 +3,18 @@ package com.a1.nextlocation.fragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Route;
import com.a1.nextlocation.network.ApiHandler;
public class RouteDetailFragment extends Fragment {
@@ -32,10 +36,17 @@ public class RouteDetailFragment extends Fragment {
this.routeDetailText = view.findViewById(R.id.routeDetailText);
this.routeDetailText.setText(this.route.getName());
Button startButton = view.findViewById(R.id.start_route_button);
startButton.setOnClickListener(this::startRoute);
return view;
}
public void startRoute(View view) {
ApiHandler.INSTANCE.getDirections(route);
Toast.makeText(requireContext(),"Route started!",Toast.LENGTH_SHORT).show();
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new HomeFragment()).addToBackStack(null).commit();
}
}