Search in sources :

Example 1 with EventsAdapter

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;
}
Also used : SimpleDividerItemDecoration(com.example.c4q.capstone.utils.SimpleDividerItemDecoration) Events(com.example.c4q.capstone.database.events.Events) EventsViewHolder(com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofileviews.EventsViewHolder) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) EventsAdapter(com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.EventsAdapter)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 Events (com.example.c4q.capstone.database.events.Events)1 EventsAdapter (com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofilecontroller.EventsAdapter)1 EventsViewHolder (com.example.c4q.capstone.userinterface.user.userprofilefragments.userprofileviews.EventsViewHolder)1 SimpleDividerItemDecoration (com.example.c4q.capstone.utils.SimpleDividerItemDecoration)1