-
- All Implemented Interfaces:
-
org.readium.r2.navigator.Navigator
public interface DecorableNavigator implements Navigator
A navigator able to render arbitrary decorations over a publication.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceDecorableNavigator.Listenerpublic final classDecorableNavigator.OnActivatedEventHolds the metadata about a decoration activation interaction.
-
Method Summary
Modifier and Type Method Description abstract UnitapplyDecorations(List<Decoration> decorations, String group)Declares the current state of the decorations in the given decoration group. abstract <T extends Decoration.Style> BooleansupportsDecorationStyle(KClass<T> style)Indicates whether the Navigator supports the given decoration style class. abstract UnitaddDecorationListener(String group, DecorableNavigator.Listener listener)Registers a new listener for decoration interactions in the given group. abstract UnitremoveDecorationListener(DecorableNavigator.Listener listener)Removes the given listener for all decoration interactions. abstract StateFlow<Locator>getCurrentLocator()Current position in the publication. LocatorgetCurrentLocation()-
-
Method Detail
-
applyDecorations
abstract Unit applyDecorations(List<Decoration> decorations, String group)
Declares the current state of the decorations in the given decoration group.
The Navigator will decide when to actually render each decoration efficiently. Your only responsibility is to submit the updated list of decorations when there are changes. Name each decoration group as you see fit. A good practice is to use the name of the feature requiring decorations, e.g. annotation, search, tts, etc.
-
supportsDecorationStyle
abstract <T extends Decoration.Style> Boolean supportsDecorationStyle(KClass<T> style)
Indicates whether the Navigator supports the given decoration style class.
You should check whether the Navigator supports drawing the decoration styles required by a particular feature before enabling it. For example, underlining an audiobook does not make sense, so an Audiobook Navigator would not support the
underlinedecoration style.
-
addDecorationListener
abstract Unit addDecorationListener(String group, DecorableNavigator.Listener listener)
-
removeDecorationListener
abstract Unit removeDecorationListener(DecorableNavigator.Listener listener)
Removes the given listener for all decoration interactions.
-
getCurrentLocator
abstract StateFlow<Locator> getCurrentLocator()
Current position in the publication. Can be used to save a bookmark to the current position.
-
getCurrentLocation
Locator getCurrentLocation()
-
-
-
-