use of com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.EventsAdapter in project Grupp by tmoronta1208.
the class UPEventsFragment method onCreateView.
/* public static UPEventsFragment newInstance(String title) {
UPEventsFragment fragment = new UPEventsFragment();
Bundle args = new Bundle();
args.putString("title", title);
fragment.setArguments(args);
return fragment;
}*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_events, container, false);
String currentUserID = CurrentUser.getInstance().getUserID();
rootRef = FirebaseDatabase.getInstance().getReference();
eventsRef = rootRef.child(USER_EVENTS_LIST).child(currentUserID);
recyclerView = view.findViewById(R.id.events_rec);
recyclerView.setHasFixedSize(true);
LinearLayoutManager linearLayout = new LinearLayoutManager(view.getContext());
linearLayout.setStackFromEnd(true);
linearLayout.setReverseLayout(true);
recyclerView.setLayoutManager(linearLayout);
eventsAdapter = new EventsAdapter(Events.class, R.layout.events_item_view, EventsViewHolder.class, eventsRef);
recyclerView.setAdapter(eventsAdapter);
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getContext()));
return view;
}
Aggregations