-
Notifications
You must be signed in to change notification settings - Fork 0
Customizing buttons
Jasper edited this page Aug 21, 2022
·
1 revision
Navigation customization is possible via the #setNextClickable()
and #setPreviousClickable()
methods.
As with Sendable
, Clickable
is the abstraction layer for buttons, and its default implementation is ClickableImpl
.
After setting the clickables, we add them manually by calling #addClickables()
. This might look like boilerplate, but it's the only way to ensure we have control over the order of the buttons.
You can also add extra buttons to this row.
public class Example extends Book {
public Example() {
super("example");
// {...}
// Customize the navigation buttons to our liking
setNextClickable(clickable -> clickable.setEmoji("➡️"));
setPreviousClickable(clickable -> clickable.setEmoji("⬅️"));
// Then add the buttons to the book, alongside any additional buttons you may want to add.
addClickables(
// Top to bottom, left to right.
getPreviousClickable(),
new ClickableImpl(Clickable.Style.DANGER)
.setId("example-danger")
.setEmoji("🔥"),
getNextClickable()
);
}
}