Search in sources :

Example 1 with NewChatViewHolder

use of com.macbitsgoa.ard.viewholders.NewChatViewHolder in project ARD by MobileApplicationsClub.

the class NewChatAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder generalHolder, final int position) {
    if (generalHolder.getItemViewType() == TEXT) {
        final TextViewHolder holder = (TextViewHolder) generalHolder;
        if (position == admins.size() + 1)
            holder.setText("Users");
        else
            holder.setText("Admins");
    } else {
        final NewChatViewHolder holder = (NewChatViewHolder) generalHolder;
        UserItem ui;
        if (position <= admins.size())
            ui = admins.get(position - 1);
        else
            ui = users.get(position - admins.size() - 2);
        holder.setUi(ui);
    }
}
Also used : NewChatViewHolder(com.macbitsgoa.ard.viewholders.NewChatViewHolder) TextViewHolder(com.macbitsgoa.ard.viewholders.TextViewHolder) UserItem(com.macbitsgoa.ard.models.UserItem)

Aggregations

UserItem (com.macbitsgoa.ard.models.UserItem)1 NewChatViewHolder (com.macbitsgoa.ard.viewholders.NewChatViewHolder)1 TextViewHolder (com.macbitsgoa.ard.viewholders.TextViewHolder)1