package chat.rocket.android.layouthelper.chatroom.roomlist;

import android.support.v7.widget.RecyclerView;

import chat.rocket.android.widget.internal.RoomListItemView;
import chat.rocket.core.models.Room;
import chat.rocket.core.models.SpotlightRoom;

public class RoomListItemViewHolder extends RecyclerView.ViewHolder {
  public RoomListItemViewHolder(RoomListItemView itemView,
                                RoomListAdapter.OnItemClickListener listener) {
    super(itemView);

    itemView.setOnClickListener(view -> {
      if (listener != null) {
        Object tag = view.getTag();

        if (tag instanceof Room) {
          listener.onItemClick((Room) view.getTag());
        } else if (tag instanceof SpotlightRoom) {
          listener.onItemClick((SpotlightRoom) view.getTag());
        }
      }
    });
  }

  public void bind(Room room) {
    ((RoomListItemView) itemView)
        .setRoomId(room.getRoomId())
        .setRoomName(room.getName())
        .setRoomType(room.getType())
        .setAlert(room.isAlert())
        .setUnreadCount(room.getUnread())
        .setTag(room);
  }

  public void bind(SpotlightRoom spotlightRoom) {
    ((RoomListItemView) itemView)
        .setRoomId(spotlightRoom.getId())
        .setRoomName(spotlightRoom.getName())
        .setRoomType(spotlightRoom.getType())
        .setAlert(false)
        .setUnreadCount(0)
        .setTag(spotlightRoom);
  }
}

@@ -240,20 +240,16 @@
 potlight
-Room
 ;%0A%0Apubli
@@ -707,36 +707,32 @@
 anceof Spotlight
-Room
 ) %7B%0A          li
@@ -760,20 +760,16 @@
 potlight
-Room
 ) view.g
@@ -1118,20 +1118,16 @@
 potlight
-Room
  spotlig
@@ -1128,20 +1128,16 @@
 potlight
-Room
 ) %7B%0A    
@@ -1190,28 +1190,24 @@
 Id(spotlight
-Room
 .getId())%0A  
@@ -1230,28 +1230,24 @@
 me(spotlight
-Room
 .getName())%0A
@@ -1276,20 +1276,16 @@
 potlight
-Room
 .getType
@@ -1365,20 +1365,16 @@
 potlight
-Room
 );%0A  %7D%0A%7D

Update RoomListItemViewHolder.java