Package 

Interface Navigator


  • 
    public interface Navigator
    
                        

    Base interface for a navigator rendering a publication.

    A few points to keep in mind when implementing this interface:

    • The navigator should have a minimal UX and be focused only on browsing and interacting with the document. However, it offers a rich API to build a user interface around it.

    • The last read page (progression) should not be persisted and restored by the navigator. Instead, the reading app will save the Locator reported by the navigator in currentLocator, and provide the initial location when creating the navigator.

    • User accessibility settings should override the behavior when needed (eg. disabling animated transition, even when requested by the caller).

    • The navigator is the single source of truth for the current location.

    • The navigator should only provide a minimal gestures/interactions set. For example, scrolling through a web view or zooming a fixed image is expected from the user. But additional interactions such as tapping/clicking the edge of the page to skip to the next one should be implemented by the reading app, and not the navigator.

    • Method Summary

      Modifier and Type Method Description
      abstract Boolean go(Locator locator, Boolean animated) Moves to the position in the publication corresponding to the given Locator.
      abstract Boolean go(Link link, Boolean animated) Moves to the position in the publication targeted by the given link.
      abstract StateFlow<Locator> getCurrentLocator() Current position in the publication.
      Locator getCurrentLocation()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • go

         abstract Boolean go(Locator locator, Boolean animated)

        Moves to the position in the publication corresponding to the given Locator.

      • go

         abstract Boolean go(Link link, Boolean animated)

        Moves to the position in the publication targeted by the given link.

      • getCurrentLocator

         abstract StateFlow<Locator> getCurrentLocator()

        Current position in the publication. Can be used to save a bookmark to the current position.