-
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 and populate onto a layout.
- Inherit and implement from
InteractiveChatNode
. - Inherit and implement from
HasText
if it also handles text. (optional) - Create an inner
Builder
static class with fluent interface. - Implement
equals()
andhashCode()
methods. - Add the interfaces you need.
About the ViewType
- Unique ID resource, which will be handled by RecyclerView.Adapter#
getViewType()
<item type="id" name="my_node_view_type" />
About the ViewHolderBuilder
- Implementation of ViewHolderBuilder, that will be consumed by RecyclerView.Adapter#
onBindViewHolder
return MyNodeViewHolderBuilder.build();
Have a look at TextMessage and TextMessageViewHolderBuilder to learn more.
You will create a class with metadata and apply onto a View.
- Inherit and implement from
Action
. - Create an inner
Builder
static class with fluent interface. - Implement
compareTo()
,equals()
andhashCode()
methods. - Add the interfaces you need.
About the ViewBuilder
- Essentially you have to return a View
, which is one of the items of a list of Action
s.
About the Feedback
- You will build and return an Feedback
based on the Action
the user has selected.
Have a look at ActionText and ActionTextViewBuilder to learn more.
You will build a class with the Action
metadata and populate onto a layout.
It is very similar on how you create a message-like
component.
Have a look at FeedbackText and FeedbackTextViewHolderBuilder to learn more.
If you have any question, please open an issue.