-
Notifications
You must be signed in to change notification settings - Fork 3
Create a new Node Component
Before to continue, you must be familiar with RecyclerView and Recyclerview.ViewHolder patterns and implementations.
You can create components from any of the following models:
You will create a class with metadata to populate onto a layout.
- Inherit and implement from
ChatNode
. - Inherit and implement from
ChatNodeText
if it also handles text. (optional, it could be an image) - Create an inner
Builder
static class with fluent interface. - Implement
equals()
andhashCode()
methods. - Follow the contract's interfaces.
About the ViewType
- It must be a unique ID resource
<item type="id" name="my_own_component_unique_view_type" />
About the ViewHolderBuilder
- It must be an implementation of ChatViewHolderBuilder
return MyOwnComponentUniqueViewHolderBuilder.build();
Please have a look at ChatMessageText and ChatMessageTextViewHolderBuilder to learn more.
You will create a class with metadata to apply onto a View.
- Inherit and implement from
ChatAction
. - Create an inner
Builder
static class with fluent interface. - Implement
compareTo()
,equals()
andhashCode()
methods. - Follow the contract's interfaces.
About the ViewBuilder
- Essentially you have to return a View
object.
About the ActionFeedback
- You will build and return a ActionFeedback
object based on the Action
metadata.
Please have a look at ChatActionText and ChatActionTextViewBuilder to learn more.
You will build a class with the Action
metadata and apply onto a layout.
It is very similar on how you create a message-like
component.
Please have a look at ChatActionFeedbackText and ChatActionFeedbackTextViewHolderBuilder to learn more.
If you have any question, please open an issue.