-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.view.View.OnCreateContextMenuListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,org.readium.r2.navigator.DecorableNavigator,org.readium.r2.navigator.HyperlinkNavigator,org.readium.r2.navigator.Navigator,org.readium.r2.navigator.OverflowableNavigator,org.readium.r2.navigator.SelectableNavigator,org.readium.r2.navigator.VisualNavigator,org.readium.r2.navigator.preferences.Configurable
public final class EpubNavigatorFragment extends NavigatorFragment implements OverflowableNavigator, SelectableNavigator, DecorableNavigator, HyperlinkNavigator, Configurable<EpubSettings, EpubPreferences>
Navigator for EPUB publications.
To use this Fragment, create a factory with
EpubNavigatorFragment.createFactory().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classEpubNavigatorFragment.Configurationpublic interfaceEpubNavigatorFragment.PaginationListenerpublic interfaceEpubNavigatorFragment.Listenerpublic classEpubNavigatorFragment.Companion
-
Field Summary
-
Method Summary
Modifier and Type Method Description StateFlow<EpubSettings>getSettings()final SharedPreferencesgetPreferences()ViewgetPublicationView()StateFlow<OverflowableNavigator.Overflow>getOverflow()ReadingProgressiongetReadingProgression()StateFlow<Locator>getCurrentLocator()LifecyclegetLifecycle()ViewModelStoregetViewModelStore()CreationExtrasgetDefaultViewModelCreationExtras()ViewModelProvider.FactorygetDefaultViewModelProviderFactory()final SavedStateRegistrygetSavedStateRegistry()LocatorgetCurrentLocation()StateFlow<Object>getPresentation()UnitsubmitPreferences(EpubPreferences preferences)Submits a new set of Preferences to update the current Settings. final StringevaluateJavascript(String script)Evaluates the given JavaScript on the currently visible HTML resource. ViewonCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)UnitonViewCreated(View view, Bundle savedInstanceState)UnitonSaveInstanceState(Bundle outState)UnitonResume()Booleango(Locator locator, Boolean animated)Moves to the position in the publication corresponding to the given Locator. Booleango(Link link, Boolean animated)Moves to the position in the publication targeted by the given link. UnitaddInputListener(InputListener listener)Adds a new InputListener to receive touch, mouse or keyboard events. UnitremoveInputListener(InputListener listener)Removes a previously registered InputListener. SelectioncurrentSelection()Currently selected content. UnitclearSelection()Clears the current selection. <T extends Decoration.Style> BooleansupportsDecorationStyle(KClass<T> style)Indicates whether the Navigator supports the given decoration style class. UnitaddDecorationListener(String group, DecorableNavigator.Listener listener)Registers a new listener for decoration interactions in the given group. UnitremoveDecorationListener(DecorableNavigator.Listener listener)Removes the given listener for all decoration interactions. UnitapplyDecorations(List<Decoration> decorations, String group)Declares the current state of the decorations in the given decoration group. BooleangoForward(Boolean animated)Moves to the next content portion (eg. BooleangoBackward(Boolean animated)Moves to the previous content portion (eg. LocatorfirstVisibleElementLocator()Returns the Locator to the first HTML block element that is visible on the screen, even if it begins on previous screen pages. -
Methods inherited from class org.readium.r2.navigator.epub.EpubNavigatorFragment
onCreate -
Methods inherited from class org.readium.r2.navigator.NavigatorFragment
callStartTransitionListener, createFragmentContainer, dump, equals, findFragmentByWho, generateActivityResultKey, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getAnimatingAway, getArguments, getChildFragmentManager, getContext, getEnterAnim, getEnterTransition, getEnterTransitionCallback, getExitAnim, getExitTransition, getExitTransitionCallback, getFocusedView, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLoaderManager, getNextTransition, getParentFragment, getParentFragmentManager, getPopDirection, getPopEnterAnim, getPopExitAnim, getPostOnViewCreatedAlpha, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getSharedElementSourceNames, getSharedElementTargetNames, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, hasOptionsMenu, hashCode, initState, isAdded, isDetached, isHidden, isInBackStack, isInLayout, isMenuVisible, isPostponed, isRemoving, isResumed, isStateSaved, isVisible, noteStateNotSaved, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onStart, onStop, onViewStateRestored, performActivityCreated, performAttach, performConfigurationChanged, performContextItemSelected, performCreate, performCreateOptionsMenu, performCreateView, performDestroy, performDestroyView, performDetach, performGetLayoutInflater, performLowMemory, performMultiWindowModeChanged, performOptionsItemSelected, performOptionsMenuClosed, performPause, performPictureInPictureModeChanged, performPrepareOptionsMenu, performPrimaryNavigationFragmentChanged, performResume, performSaveInstanceState, performStart, performStop, performViewCreated, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, restoreChildFragmentState, restoreViewState, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setAnimations, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setFocusedView, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setNextTransition, setPopDirection, setPostOnViewCreatedAlpha, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementNames, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getSettings
StateFlow<EpubSettings> getSettings()
-
getPreferences
final SharedPreferences getPreferences()
-
getPublicationView
View getPublicationView()
-
getOverflow
StateFlow<OverflowableNavigator.Overflow> getOverflow()
-
getReadingProgression
ReadingProgression getReadingProgression()
-
getCurrentLocator
StateFlow<Locator> getCurrentLocator()
-
getLifecycle
@NonNull() Lifecycle getLifecycle()
-
getViewModelStore
@NonNull() ViewModelStore getViewModelStore()
-
getDefaultViewModelCreationExtras
@NonNull()@CallSuper() CreationExtras getDefaultViewModelCreationExtras()
-
getDefaultViewModelProviderFactory
@NonNull() ViewModelProvider.Factory getDefaultViewModelProviderFactory()
-
getSavedStateRegistry
@NonNull() final SavedStateRegistry getSavedStateRegistry()
-
getCurrentLocation
Locator getCurrentLocation()
-
getPresentation
StateFlow<Object> getPresentation()
-
submitPreferences
Unit submitPreferences(EpubPreferences preferences)
Submits a new set of Preferences to update the current Settings.
Note that the Configurable might not update its settings right away, or might even ignore some of the provided preferences. They are only used as hints to compute the new settings.
-
evaluateJavascript
final String evaluateJavascript(String script)
Evaluates the given JavaScript on the currently visible HTML resource.
Note that this only work with reflowable resources.
-
onCreateView
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
-
onViewCreated
Unit onViewCreated(View view, Bundle savedInstanceState)
-
onSaveInstanceState
Unit onSaveInstanceState(Bundle outState)
-
go
Boolean go(Locator locator, Boolean animated)
Moves to the position in the publication corresponding to the given Locator.
-
go
Boolean go(Link link, Boolean animated)
Moves to the position in the publication targeted by the given link.
-
addInputListener
Unit addInputListener(InputListener listener)
Adds a new InputListener to receive touch, mouse or keyboard events.
Registration order is critical, as listeners may consume the events and prevent others from receiving them.
-
removeInputListener
Unit removeInputListener(InputListener listener)
Removes a previously registered InputListener.
-
currentSelection
Selection currentSelection()
Currently selected content.
-
clearSelection
Unit clearSelection()
Clears the current selection.
-
supportsDecorationStyle
<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
Unit addDecorationListener(String group, DecorableNavigator.Listener listener)
-
removeDecorationListener
Unit removeDecorationListener(DecorableNavigator.Listener listener)
Removes the given listener for all decoration interactions.
-
applyDecorations
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.
-
goForward
Boolean goForward(Boolean animated)
Moves to the next content portion (eg. page) in the reading progression direction.
-
goBackward
Boolean goBackward(Boolean animated)
Moves to the previous content portion (eg. page) in the reading progression direction.
-
firstVisibleElementLocator
Locator firstVisibleElementLocator()
Returns the Locator to the first HTML block element that is visible on the screen, even if it begins on previous screen pages.
-
-
-
-