Merge remote-tracking branch 'origin/develop' into Tests

This commit is contained in:
Robin Koedood
2021-01-06 11:14:19 +01:00
19 changed files with 549 additions and 88 deletions

View File

@@ -9,10 +9,13 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
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 {
@@ -35,6 +38,8 @@ 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);
this.imageButton = view.findViewById(R.id.route_detail_back_button);
this.imageButton.setOnClickListener(v -> {
@@ -45,4 +50,11 @@ public class RouteDetailFragment extends Fragment {
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();
}
}