use of cl.smartcities.isci.transportinspector.adapters.ReportAdapter in project androidApp by InspectorIncognito.
the class BusReportDetailsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_fragment_reports_layout);
Bundle bundle = this.getIntent().getExtras();
ArrayList<ServerSentEvent> events = bundle.getParcelableArrayList(EVENTS);
RecyclerView incomingBusesRecyclerView = findViewById(R.id.reports_recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
incomingBusesRecyclerView.setLayoutManager(layoutManager);
incomingBusesRecyclerView.addItemDecoration(new InsetDecoration(this));
ReportAdapter.ReportClickedListener reportClickedListener = new ReportAdapter.ReportClickedListener() {
@Override
public void onApprovalClicked(ServerSentEvent event) {
EventRequest request = getRequest(event, true);
request.setRequestToConfirm();
ServerController.sendRequest(request, null);
}
@Override
public void onDeclinedClicked(ServerSentEvent event) {
EventRequest request = getRequest(event, false);
request.setRequestToDecline();
ServerController.sendRequest(request, null);
}
};
bus = bundle.getParcelable(BUSES);
/*if (bundle.keySet().contains(IS_USER_BUS)) {
adapter = new ReportAdapter(events, bus, reportClickedListener, validationClickedListener);
} else {
adapter = new ReportAdapter(events, bus, reportClickedListener, validationClickedListener);
}*/
adapter = new ReportAdapter(events, bus, reportClickedListener, validationClickedListener);
incomingBusesRecyclerView.setAdapter(adapter);
}
use of cl.smartcities.isci.transportinspector.adapters.ReportAdapter in project androidApp by InspectorIncognito.
the class BusStopReportFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.detail_fragment_reports_layout, container, false);
RecyclerView incomingBusesRecyclerView = view.findViewById(R.id.reports_recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager(this.getContext());
incomingBusesRecyclerView.setLayoutManager(layoutManager);
incomingBusesRecyclerView.addItemDecoration(new InsetDecoration(getContext()));
adapter = new ReportAdapter(events, busStop, new ReportAdapter.ReportClickedListener() {
@Override
public void onApprovalClicked(ServerSentEvent event) {
EventRequest request = getRequest(event, true);
request.setRequestToConfirm();
ServerController.sendRequest(request, null);
}
@Override
public void onDeclinedClicked(ServerSentEvent event) {
EventRequest request = getRequest(event, false);
request.setRequestToDecline();
ServerController.sendRequest(request, null);
}
}, validationClickedListener);
incomingBusesRecyclerView.setAdapter(adapter);
return view;
}
Aggregations