Search in sources :

Example 1 with UserAdapter

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

the class ChatFragment 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_chat, container, false);
    recycle = view.findViewById(R.id.recycle_users);
    ArrayList<User> chatList = new ArrayList<>();
    for (Map.Entry<String, User> entry : BaseActivity.getChatMap().entrySet()) chatList.add(entry.getValue());
    recycleAdapter = new UserAdapter(chatList, getContext());
    RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 1);
    recycle.setLayoutManager(layoutManager);
    recycle.setItemAnimator(new DefaultItemAnimator());
    recycle.setAdapter(recycleAdapter);
    return view;
}
Also used : User(garbagecollectors.com.unipool.models.User) GridLayoutManager(android.support.v7.widget.GridLayoutManager) ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) UserAdapter(garbagecollectors.com.unipool.adapters.UserAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) 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 UserAdapter (garbagecollectors.com.unipool.adapters.UserAdapter)1 User (garbagecollectors.com.unipool.models.User)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1