I'm using the Firebase RecyclerAdapter to display a list of things. How do I change the colour of all the items in the RecyclerView except the selected item back to a different colour? Changing the colour of the selected item is straightforward.
FirebaseRecyclerAdapter<Home_List, SubChatHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Home_List, SubChatHolder>(
Home_List.class,
R.layout.single_division_layout,
SubChatHolder.class,
ref
) {
@Override
protected void populateViewHolder(final SubChatHolder viewHolder, final Home_List model, int position) {
final String id = getRef(position).getKey();
viewHolder.setName(model.getName());
viewHolder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mView.viewHolder.setSelectedBg();
//how to uncolour the previously selected item?
}
});
}
};