I have a simple chat activity built using FirebaseRecyclerAdapter where each view is a message. I'd like to support a typing indicator that visually looks like an additional message.
My first thought was to add a footer view to the recycler adapter by following instructions similar to Android 5.0 - Add header/footer to a RecyclerView. However, I can't figure out how to insert and remove the special type of view when using a FirebaseIndexRecyclerAdapter.
My code:
// setting up the recycler view adapter
mAdapter = new FirebaseIndexRecyclerAdapter<ChatMessage, MessageHolder>(
ChatMessage.class,
R.layout.chat_message_item,
MessageHolder.class,
keyRef,
dataRef) {
@Override
public void populateViewHolder(final MessageHolder chatViewHolder, final ChatMessage chatMessage, final int position) {
Log.d(TAG, chatMessage.toString());
chatViewHolder.setMessage(chatMessage.getText());
}
};
recyclerView.setAdapter(mAdapter);