Class DocumentState
-
- All Implemented Interfaces:
-
com.pspdfkit.listeners.OnVisibilityChangedListener
public abstract class DocumentState implements OnVisibilityChangedListener
A state object that can be hoisted to control and observe properties of the com.pspdfkit.jetpack.compose.views.DocumentView. Create instances of this object using rememberDocumentState.
-
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<Boolean>
viewWithOverlappingToolbarShown
private DocumentConnection
documentConnection
-
Method Summary
Modifier and Type Method Description final StateFlow<Boolean>
getViewWithOverlappingToolbarShown()
Keep track of whether a full screen view is shown that is not the document view so we can handle the main toolbar clipping final DocumentConnection
getDocumentConnection()
Provides ability to perform specific tasks in Document. final Unit
setDocumentConnection(DocumentConnection documentConnection)
Provides ability to perform specific tasks in Document. final Boolean
isDefaultViewerActive()
Checks if viewer is visible or not. final Unit
exitCurrentState()
Reverts back to viewer from any other State. final Unit
setOnContextualToolbarLifecycleListener(ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener listener)
Set the ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener to listen to the lifecycle of the contextual toolbar. abstract String
getTitle()
Provides the title of the document. final Unit
toggleView(Integer option)
Toggles the view based on the provided MENU_OPTIONS in com.pspdfkit.ui.PdfActivity. Unit
onShow(View view)
Called whenever a PSPDFKit view has become visible. Unit
onHide(View view)
Called whenever a PSPDFKit view has been hidden. -
-
Method Detail
-
getViewWithOverlappingToolbarShown
final StateFlow<Boolean> getViewWithOverlappingToolbarShown()
Keep track of whether a full screen view is shown that is not the document view so we can handle the main toolbar clipping
-
getDocumentConnection
final DocumentConnection getDocumentConnection()
Provides ability to perform specific tasks in Document.
-
setDocumentConnection
final Unit setDocumentConnection(DocumentConnection documentConnection)
Provides ability to perform specific tasks in Document.
-
isDefaultViewerActive
final Boolean isDefaultViewerActive()
Checks if viewer is visible or not. Default value is true
-
exitCurrentState
final Unit exitCurrentState()
Reverts back to viewer from any other State.
-
setOnContextualToolbarLifecycleListener
final Unit setOnContextualToolbarLifecycleListener(ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener listener)
Set the ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener to listen to the lifecycle of the contextual toolbar. Can be implemented in a LaunchedScope to handle the lifecycle of the contextual toolbar, i.e. LaunchedEffect(Unit) { documentState.setOnContextualToolbarLifecycleListener(object : ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener { override fun onPrepareContextualToolbar(toolbar: ContextualToolbar<*>) { if (toolbar is AnnotationCreationToolbar) { // Register grouping rule to tell toolbar how to group menu items. toolbar.setMenuItemGroupingRule(object : PresetMenuItemGroupingRule(context) { override fun getGroupPreset(capacity: Int, itemsCount: Int) = AnnotationCreationToolbarItemPresets.FOUR_ITEMS_GROUPING; }) } } }) }
-
toggleView
final Unit toggleView(Integer option)
Toggles the view based on the provided MENU_OPTIONS in com.pspdfkit.ui.PdfActivity.
- Parameters:
option
- The menu id of view to toggle.
-
-
-
-