Class PdfOutlineView
-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,com.pspdfkit.internal.views.outline.OutlinePagerBaseView.OnHideListener
,com.pspdfkit.ui.PSPDFKitViews.PSPDFView
,com.pspdfkit.ui.drawable.PdfDrawableManager
public class PdfOutlineView extends FrameLayout implements OutlinePagerBaseView.OnHideListener, PSPDFKitViews.PSPDFView, PdfDrawableManager
A layout containing the tab on the top and a view pager for switching between the outline, the list of annotations and the bookmarks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
PdfOutlineView.OnAnnotationTapListener
Annotation list tap listener. Interface of listeners for receiving taps on annotations inside the outline's annotation list.
public interface
PdfOutlineView.OnOutlineElementTapListener
Outline element tap listener. Interface of listeners for receiving taps on outline elements inside the outline list. Set this listener via setOnOutlineElementTapListener.
public interface
PdfOutlineView.OnEmbeddedFileTapListener
Embedded file tap listener. Interface of listeners for receiving taps on embedded files inside the embedded files list. Set this listener via setOnEmbeddedFileTapListener.
public interface
PdfOutlineView.DocumentOutlineProvider
Interface to objects that provide outline elements.
public final class
PdfOutlineView.OutlinePagerAdapter
A state pager adapter controlling the pager items (outline view and annotation list view) that saves and restores View states.
-
Field Summary
Fields Modifier and Type Field Description public boolean
mayContainDocumentInfoView
public boolean
isDisplayed
public final DocumentListener
documentListener
-
Constructor Summary
Constructors Constructor Description PdfOutlineView(Context context)
PdfOutlineView(Context context, AttributeSet attrs)
PdfOutlineView(Context context, AttributeSet attrs, int defStyleAttr)
PdfOutlineView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
Method Summary
Modifier and Type Method Description boolean
getMayContainDocumentInfoView()
void
setMayContainDocumentInfoView(boolean may)
boolean
isDisplayed()
Called when the activity needs to know the visibility of this view. DocumentListener
getDocumentListener()
Returns the document listener this PdfOutlineView uses. void
setUndoManager(@NonNull() UndoManager undoManager)
Sets the UndoManager used for tracking annotations removed from the annotation list. boolean
onTouchEvent(@NonNull() MotionEvent event)
boolean
performClick()
void
setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)
Called when the document
has been loaded and is going to be displayed.void
setDocumentOutlineProvider(@Nullable() PdfOutlineView.DocumentOutlineProvider outlineProvider)
Sets DocumentOutlineProvider that should be used as a source of outline elements in the outline list instead of document outline. void
setRedactionAnnotationPreviewEnabled(boolean redactionAnnotationPreviewEnabled)
void
addOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Register a listener
that would like to receive visibility change events.void
removeOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Unregister a previously registered listener
that no longer wants to receive visibility change events.void
setVisibility(int visibility)
void
show()
Shows the outline view (scroll down animation). void
clearDocument()
Called by the activity when the view should unbind the previously set document. PSPDFKitViews.Type
getPSPDFViewType()
Returns the current type of this view. void
setOutlineViewEnabled(boolean outlineViewEnabled)
Enables outline view. void
setOutlineViewEnabled(boolean outlineViewEnabled, boolean refreshViewPager)
Enables outline view. void
setDisplayEmbeddedFilesViewEnabled(boolean displayEmbeddedFilesView)
Enables the embedded files view. void
setAnnotationListViewEnabled(boolean annotationListViewEnabled)
Enables annotation list view. void
setAnnotationListViewEnabled(boolean annotationListViewEnabled, boolean refreshViewPager)
Enables annotation list view. void
setAnnotationEditingEnabled(boolean annotationEditingEnabled)
Enables additional controls in the annotation outline view to delete annotations. void
setBookmarkViewEnabled(boolean bookmarkViewEnabled)
Enables bookmark view. void
setBookmarkViewEnabled(boolean bookmarkViewEnabled, boolean refreshViewPager)
Enables bookmark view. void
setDocumentInfoViewEnabled(boolean documentInfoViewEnabled)
Enables document info view. void
setDocumentInfoViewEnabled(boolean documentInfoViewEnabled, boolean refreshViewPager)
Enables document info view. void
setBookmarkEditingEnabled(boolean bookmarkEditingEnabled)
Allows bookmark view to edit annotations. void
setBookmarkRenamingEnabled(boolean bookmarkRenamingEnabled)
Allows bookmark view to rename annotations. void
setBookmarkAdapter(@Nullable() BookmarkViewAdapter adapter)
Sets an adapter that handles actual bookmark data. void
setShowPageLabels(boolean showPageLabels)
Provide API for controlling content of the PdfOutlineView. void
setListedAnnotationTypes(@NonNull() EnumSet<AnnotationType> listedAnnotationTypes)
Sets annotation types to be listed (if the annotation list is enabled). void
setAnnotationListReorderingEnabled(boolean enable)
Sets whether reordering of annotations in the annotation list is enabled. void
hide()
Hides the outline view (scroll up animation). void
refreshViewPager()
Refreshes the view pager adapter and binds it to the pager tabs. void
addOnDocumentInfoViewModeChangeListener(@NonNull() OnDocumentInfoViewModeChangeListener listener)
Adds the listener for the editing mode changes on this document info view. void
removeOnDocumentInfoViewModeChangeListener(@NonNull() OnDocumentInfoViewModeChangeListener listener)
Removes the listener for the editing mode changes on this document info view. void
addOnDocumentInfoViewSaveListener(@NonNull() OnDocumentInfoViewSaveListener listener)
Adds the listener for saving the document info changes. void
removeOnDocumentInfoViewSaveListener(@NonNull() OnDocumentInfoViewSaveListener listener)
Removes the listener for saving the document info changes. void
addDrawableProvider(@NonNull() PdfDrawableProvider drawableProvider)
Adds a PdfDrawableProvider to be managed by this object. void
removeDrawableProvider(@NonNull() PdfDrawableProvider drawableProvider)
Removes a previously added PdfDrawableProvider. void
setOnAnnotationTapListener(@Nullable() PdfOutlineView.OnAnnotationTapListener onAnnotationTapListener)
Sets a listener to be notified of annotation tap events. void
setOnOutlineElementTapListener(@Nullable() PdfOutlineView.OnOutlineElementTapListener onOutlineElementTapListener)
Sets a listener to be notified of outline tap events. void
setOnEmbeddedFileTapListener(@Nullable() PdfOutlineView.OnEmbeddedFileTapListener onEmbeddedFileTapListener)
Sets a listener to be notified of embedded files tap events. -
-
Constructor Detail
-
PdfOutlineView
PdfOutlineView(Context context)
-
PdfOutlineView
PdfOutlineView(Context context, AttributeSet attrs)
-
PdfOutlineView
PdfOutlineView(Context context, AttributeSet attrs, int defStyleAttr)
-
PdfOutlineView
PdfOutlineView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
-
Method Detail
-
getMayContainDocumentInfoView
boolean getMayContainDocumentInfoView()
-
setMayContainDocumentInfoView
void setMayContainDocumentInfoView(boolean may)
-
isDisplayed
boolean isDisplayed()
Called when the activity needs to know the visibility of this view. Returns
true
if this view is visible, otherwise returnsfalse
.
-
getDocumentListener
@NonNull() DocumentListener getDocumentListener()
Returns the document listener this PdfOutlineView uses.
-
setUndoManager
void setUndoManager(@NonNull() UndoManager undoManager)
Sets the UndoManager used for tracking annotations removed from the annotation list.
-
onTouchEvent
boolean onTouchEvent(@NonNull() MotionEvent event)
-
performClick
boolean performClick()
-
setDocument
@UiThread() void setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)
Called when the
document
has been loaded and is going to be displayed. This has to be called on the main thread.- Parameters:
document
- Loaded PdfDocument.configuration
- Containing document and presentation settings.
-
setDocumentOutlineProvider
@UiThread() void setDocumentOutlineProvider(@Nullable() PdfOutlineView.DocumentOutlineProvider outlineProvider)
Sets DocumentOutlineProvider that should be used as a source of outline elements in the outline list instead of document outline.
Note that the DocumentOutlineProvider is not retained when restarting the Activity to prevent memory leaks. It's responsibility of the caller of this API to make sure that the custom outline provider is restored after the activity is restarted.
- Parameters:
outlineProvider
- Outline provider to use ornull
to use default outline from the document.
-
setRedactionAnnotationPreviewEnabled
void setRedactionAnnotationPreviewEnabled(boolean redactionAnnotationPreviewEnabled)
-
addOnVisibilityChangedListener
void addOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Register a
listener
that would like to receive visibility change events. Whenever the visibility of a managed PSPDFView changes, all registered listeners will be notified.- Parameters:
listener
- Listener to be added.
-
removeOnVisibilityChangedListener
void removeOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Unregister a previously registered
listener
that no longer wants to receive visibility change events.- Parameters:
listener
- Listener to be removed.
-
setVisibility
void setVisibility(int visibility)
-
show
void show()
Shows the outline view (scroll down animation).
-
clearDocument
void clearDocument()
Called by the activity when the view should unbind the previously set document. This may be called in low-memory situations or prior to re-binding another document.
-
getPSPDFViewType
@NonNull() PSPDFKitViews.Type getPSPDFViewType()
Returns the current type of this view.
- Returns:
Any of Type.
-
setOutlineViewEnabled
void setOutlineViewEnabled(boolean outlineViewEnabled)
Enables outline view.
- Parameters:
outlineViewEnabled
- Iftrue
, outline view will be shown.
-
setOutlineViewEnabled
void setOutlineViewEnabled(boolean outlineViewEnabled, boolean refreshViewPager)
Enables outline view.
- Parameters:
outlineViewEnabled
- Iftrue
, outline view will be shown.refreshViewPager
- Iftrue
, the view pager will be refreshed.
-
setDisplayEmbeddedFilesViewEnabled
void setDisplayEmbeddedFilesViewEnabled(boolean displayEmbeddedFilesView)
Enables the embedded files view.
- Parameters:
displayEmbeddedFilesView
- Iftrue
, embedded files view will be shown.
-
setAnnotationListViewEnabled
void setAnnotationListViewEnabled(boolean annotationListViewEnabled)
Enables annotation list view.
- Parameters:
annotationListViewEnabled
- Iftrue
, annotation list view will be shown.
-
setAnnotationListViewEnabled
void setAnnotationListViewEnabled(boolean annotationListViewEnabled, boolean refreshViewPager)
Enables annotation list view.
- Parameters:
annotationListViewEnabled
- Iftrue
, annotation list view will be shown.refreshViewPager
- Iftrue
, the view pager will be refreshed.
-
setAnnotationEditingEnabled
void setAnnotationEditingEnabled(boolean annotationEditingEnabled)
Enables additional controls in the annotation outline view to delete annotations.
- Parameters:
annotationEditingEnabled
- Iftrue
additional buttons to delete single or all annotations are shown.
-
setBookmarkViewEnabled
void setBookmarkViewEnabled(boolean bookmarkViewEnabled)
Enables bookmark view.
- Parameters:
bookmarkViewEnabled
- Iftrue
, bookmark list view will be shown.
-
setBookmarkViewEnabled
void setBookmarkViewEnabled(boolean bookmarkViewEnabled, boolean refreshViewPager)
Enables bookmark view.
- Parameters:
bookmarkViewEnabled
- Iftrue
, bookmark list view will be shown.refreshViewPager
- Iftrue
, the view pager will be refreshed.
-
setDocumentInfoViewEnabled
void setDocumentInfoViewEnabled(boolean documentInfoViewEnabled)
Enables document info view.
- Parameters:
documentInfoViewEnabled
- Iftrue
, document info view will be shown.
-
setDocumentInfoViewEnabled
void setDocumentInfoViewEnabled(boolean documentInfoViewEnabled, boolean refreshViewPager)
Enables document info view.
- Parameters:
documentInfoViewEnabled
- Iftrue
, document info view will be shown.refreshViewPager
- Iftrue
, the view pager will be refreshed.
-
setBookmarkEditingEnabled
void setBookmarkEditingEnabled(boolean bookmarkEditingEnabled)
Allows bookmark view to edit annotations.
- Parameters:
bookmarkEditingEnabled
- Iftrue
, bookmarks can be edited.
-
setBookmarkRenamingEnabled
void setBookmarkRenamingEnabled(boolean bookmarkRenamingEnabled)
Allows bookmark view to rename annotations.
- Parameters:
bookmarkRenamingEnabled
- Iftrue
, bookmarks can be renamed.
-
setBookmarkAdapter
void setBookmarkAdapter(@Nullable() BookmarkViewAdapter adapter)
Sets an adapter that handles actual bookmark data.
- Parameters:
adapter
- Adapter that providers bookmark view with data and handles data changes.
-
setShowPageLabels
void setShowPageLabels(boolean showPageLabels)
Provide API for controlling content of the PdfOutlineView. Set should the outline view show page labels. If disabled, only page numbers are shown.
- Parameters:
showPageLabels
- Iftrue
, page labels will be displayed in outline (if any).
-
setListedAnnotationTypes
void setListedAnnotationTypes(@NonNull() EnumSet<AnnotationType> listedAnnotationTypes)
Sets annotation types to be listed (if the annotation list is enabled).
- Parameters:
listedAnnotationTypes
- List of annotation types to be displayed in the annotation list.
-
setAnnotationListReorderingEnabled
void setAnnotationListReorderingEnabled(boolean enable)
Sets whether reordering of annotations in the annotation list is enabled. This defaults to
true
.- Parameters:
enable
-true
to enable reordering annotations in the annotation list.
-
hide
void hide()
Hides the outline view (scroll up animation).
-
refreshViewPager
@UiThread() void refreshViewPager()
Refreshes the view pager adapter and binds it to the pager tabs. This has to be called on the main thread.
-
addOnDocumentInfoViewModeChangeListener
void addOnDocumentInfoViewModeChangeListener(@NonNull() OnDocumentInfoViewModeChangeListener listener)
Adds the listener for the editing mode changes on this document info view.
- Parameters:
listener
- Listener for mode changes to be added.
-
removeOnDocumentInfoViewModeChangeListener
void removeOnDocumentInfoViewModeChangeListener(@NonNull() OnDocumentInfoViewModeChangeListener listener)
Removes the listener for the editing mode changes on this document info view.
- Parameters:
listener
- Listener for mode changes to be removed.
-
addOnDocumentInfoViewSaveListener
void addOnDocumentInfoViewSaveListener(@NonNull() OnDocumentInfoViewSaveListener listener)
Adds the listener for saving the document info changes.
- Parameters:
listener
- Listener to be added.
-
removeOnDocumentInfoViewSaveListener
void removeOnDocumentInfoViewSaveListener(@NonNull() OnDocumentInfoViewSaveListener listener)
Removes the listener for saving the document info changes.
- Parameters:
listener
- Listener to be removed.
-
addDrawableProvider
void addDrawableProvider(@NonNull() PdfDrawableProvider drawableProvider)
Adds a PdfDrawableProvider to be managed by this object. If the provider has been added previously, this method will be a no-op. Adding
null
is not allowed, and will result in an exception.- Parameters:
drawableProvider
- PdfDrawableProvider whose drawable instances should be managed (e.g.
-
removeDrawableProvider
void removeDrawableProvider(@NonNull() PdfDrawableProvider drawableProvider)
Removes a previously added PdfDrawableProvider. If the provider hasn't been added previously, this method will be a no-op.
- Parameters:
drawableProvider
- PdfDrawableProvider that should be removed.
-
setOnAnnotationTapListener
void setOnAnnotationTapListener(@Nullable() PdfOutlineView.OnAnnotationTapListener onAnnotationTapListener)
Sets a listener to be notified of annotation tap events. Calling this method will replace any previously set listener. You may provide
null
to clear the listener.- Parameters:
onAnnotationTapListener
- OnAnnotationTapListener that should be notified, ornull
to clear the listener.
-
setOnOutlineElementTapListener
void setOnOutlineElementTapListener(@Nullable() PdfOutlineView.OnOutlineElementTapListener onOutlineElementTapListener)
Sets a listener to be notified of outline tap events. Calling this method will replace any previously set listener. You may provide
null
to clear the listener.- Parameters:
onOutlineElementTapListener
- OnOutlineElementTapListener that should be notified, ornull
to clear the listener.
-
setOnEmbeddedFileTapListener
void setOnEmbeddedFileTapListener(@Nullable() PdfOutlineView.OnEmbeddedFileTapListener onEmbeddedFileTapListener)
Sets a listener to be notified of embedded files tap events. Calling this method will replace any previously set listener. You may provide
null
to clear the listener.- Parameters:
onEmbeddedFileTapListener
- OnEmbeddedFileTapListener that should be notified, ornull
to clear the listener.
-
-
-
-