Merge remote-tracking branch 'origin/RecyclerView' into Tests
This commit is contained in:
@@ -11,18 +11,15 @@ 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.data.RouteHandler;
|
||||
import com.a1.nextlocation.data.StaticData;
|
||||
import com.a1.nextlocation.network.ApiHandler;
|
||||
|
||||
public class RouteDetailFragment extends Fragment {
|
||||
|
||||
private Route route;
|
||||
private TextView routeDetailText;
|
||||
private TextView routeName;
|
||||
private ImageButton imageButton;
|
||||
|
||||
@Override
|
||||
@@ -38,10 +35,11 @@ public class RouteDetailFragment extends Fragment {
|
||||
this.route = getArguments().getParcelable("route");
|
||||
}
|
||||
|
||||
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.routeName = view.findViewById(R.id.route_title);
|
||||
this.routeName.setText(this.route.getName());
|
||||
|
||||
this.routeDetailText = view.findViewById(R.id.reoute_detail_tekst);
|
||||
this.routeDetailText.setText(this.route.getDescription());
|
||||
|
||||
this.imageButton = view.findViewById(R.id.route_detail_back_button);
|
||||
this.imageButton.setOnClickListener(v -> {
|
||||
@@ -52,12 +50,4 @@ public class RouteDetailFragment extends Fragment {
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void startRoute(View view) {
|
||||
ApiHandler.INSTANCE.getDirections(route);
|
||||
RouteHandler.INSTANCE.followRoute(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();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user