use of org.fossasia.openevent.app.core.attendee.list.listeners.AttendeeItemCheckInEvent in project open-event-orga-app by fossasia.
the class AttendeesFragment method setupRecyclerView.
private void setupRecyclerView() {
if (!initialized) {
fastItemAdapter = new ItemAdapter<>();
fastItemAdapter.getItemFilter().withFilterPredicate((attendee, query) -> {
if (query == null)
return true;
if (query.equals(FILTER_SYNC)) {
return attendee.checking.get();
}
return !SearchUtils.filter(query.toString(), attendee.getFirstname(), attendee.getLastname(), attendee.getEmail());
});
stickyHeaderAdapter = new StickyHeaderAdapter<>();
stickyHeaderAdapter.setSortByName(false);
fastAdapter = FastAdapter.with(Arrays.asList(fastItemAdapter, stickyHeaderAdapter));
fastAdapter.setHasStableIds(true);
fastAdapter.withEventHook(new AttendeeItemCheckInEvent(this));
RecyclerView recyclerView = binding.rvAttendeeList;
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(fastAdapter);
final StickyRecyclerHeadersDecoration decoration = new StickyRecyclerHeadersDecoration(stickyHeaderAdapter);
recyclerView.addItemDecoration(decoration);
observer = new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
decoration.invalidateHeaders();
}
};
fastAdapter.registerAdapterDataObserver(observer);
ViewUtils.setRecyclerViewScrollAwareFabBehaviour(recyclerView, binding.fabScanQr);
}
}
Aggregations