Search in sources :

Example 1 with SentRequestsTEA

use of garbagecollectors.com.unipool.adapters.SentRequestsTEA in project UniPool by divya21raj.

the class SentRequestsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_sent_requests, container, false);
    finalCurrentUser = RequestActivity.getFinalCurrentUser();
    sentRequests = finalCurrentUser.getRequestSent();
    recycle = view.findViewById(R.id.recycle_requests);
    if (sentRequests.size() >= 1) {
        ArrayList<TripEntry> sentRequestsList = new ArrayList<>();
        for (Map.Entry<String, TripEntry> entry : sentRequests.entrySet()) {
            if (!entry.getKey().equals("dummyId"))
                sentRequestsList.add(entry.getValue());
        }
        recyclerAdapter = new SentRequestsTEA(sentRequestsList, getContext());
        RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 1);
        recycle.setLayoutManager(layoutManager);
        recycle.setItemAnimator(new DefaultItemAnimator());
        recycle.setAdapter(recyclerAdapter);
    }
    return view;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SentRequestsTEA(garbagecollectors.com.unipool.adapters.SentRequestsTEA) ArrayList(java.util.ArrayList) TripEntry(garbagecollectors.com.unipool.models.TripEntry) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) HashMap(java.util.HashMap) Map(java.util.Map) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 SentRequestsTEA (garbagecollectors.com.unipool.adapters.SentRequestsTEA)1 TripEntry (garbagecollectors.com.unipool.models.TripEntry)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1