java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.RelativeLayout | |||
↳ | com.pspdfkit.ui.PdfThumbnailGrid |
Scrollable grid view of document pages.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | PdfThumbnailGrid.OnDocumentSavedListener | Listener for document saving inside PdfThumbnailGrid . |
|||||||||
interface | PdfThumbnailGrid.OnPageClickListener | Listener for observing a PdfThumbnailGrid page click. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PdfThumbnailGrid(Context context) | |||||||||||
PdfThumbnailGrid(Context context, AttributeSet attrs) | |||||||||||
PdfThumbnailGrid(Context context, AttributeSet attrs, int defStyleAttr) | |||||||||||
PdfThumbnailGrid(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addDrawableProvider(PdfDrawableProvider drawableProvider)
Adds a
PdfDrawableProvider to be managed by this object. | ||||||||||
void |
addOnDocumentSavedListener(PdfThumbnailGrid.OnDocumentSavedListener onDocumentSavedListener)
Adds a listener that will be notified about document saves inside the thumbnail grid.
| ||||||||||
void |
addOnPageClickListener(PdfThumbnailGrid.OnPageClickListener onPageClickListener)
Adds a listener that will be notified when a page on the ThumbnailGrid was clicked.
| ||||||||||
void |
addOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Register a
listener that would like to receive visibility change events. | ||||||||||
void |
clearDocument()
Called by the activity when the view should unbind the previously set document.
| ||||||||||
void |
enterDocumentEditingMode()
Enters document editing mode.
| ||||||||||
void |
exitDocumentEditingMode()
Exits document editing mode.
| ||||||||||
View | focusSearch(View focused, int direction) | ||||||||||
int |
getBackgroundColor()
Returns the background color of the thumbnail grid.
| ||||||||||
NewPageDialog.Callback |
getDefaultNewPageDialogCallback()
Returns The default
NewPageDialog.Callback that is used by default by the PdfThumbnailGrid . | ||||||||||
PdfDocumentEditor |
getDocumentEditor()
Returns document editor to perform operations such as page manipulation, reordering and
importing documents.
| ||||||||||
FilePicker |
getFilePicker()
Returns a file picker to use during a saving process.
| ||||||||||
int |
getItemLabelBackground()
Returns the thumbnail grid background label background.
| ||||||||||
int |
getItemLabelTextStyle()
Returns the thumbnail grid item's label text style.
| ||||||||||
PSPDFKitViews.Type |
getPSPDFViewType()
Returns the current type of this view.
| ||||||||||
Set<Integer> |
getSelectedPages()
Retrieves the currently selected pages of the thumbnail grid.
| ||||||||||
void |
hide()
Called by the activity when the view should hide itself.
| ||||||||||
boolean |
isDisplayed()
Called when the activity needs to know the visibility of this view.
| ||||||||||
boolean | isDocumentEditorEnabled() | ||||||||||
boolean |
isRedactionAnnotationPreviewEnabled()
Returns redaction annotation preview mode,
false by default. | ||||||||||
boolean |
isShowPageLabels()
Returns
true if page labels are shown, false otherwise. | ||||||||||
boolean |
onDocumentClick()
Called when the user taps / clicks on the document, not the page itself but on the side (if
visible).
| ||||||||||
void | onDocumentExported(Uri destinationUri) | ||||||||||
void |
onDocumentLoadFailed(Throwable exception)
Called if document loading has failed.
| ||||||||||
void |
onDocumentLoaded(PdfDocument document)
Called when document is successfully loaded and the document view has been laid out.
| ||||||||||
boolean |
onDocumentSave(PdfDocument document, DocumentSaveOptions saveOptions)
Called before document will be saved.
| ||||||||||
void |
onDocumentSaveCancelled(PdfDocument document)
Called if document saving has been cancelled.
| ||||||||||
void |
onDocumentSaveFailed(PdfDocument document, Throwable exception)
Called if document saving has failed.
| ||||||||||
void | onDocumentSaved() | ||||||||||
void |
onDocumentSaved(PdfDocument document)
Called after the document has been saved.
| ||||||||||
void |
onDocumentZoomed(PdfDocument document, int pageIndex, float scaleFactor)
Called when a user zooms a document.
| ||||||||||
void |
onPageChanged(PdfDocument document, int pageIndex)
Called when user scrolled to a new page.
| ||||||||||
boolean |
onPageClick(PdfDocument document, int pageIndex, MotionEvent event, PointF pagePosition, Annotation clickedAnnotation)
Called when user taps / clicks on the page.
| ||||||||||
void |
onPageUpdated(PdfDocument document, int pageIndex)
Called when content of page with pageIndex has changed (for example due to annotation or form
field being updated).
| ||||||||||
void |
removeDrawableProvider(PdfDrawableProvider drawableProvider)
Removes a previously added
PdfDrawableProvider . | ||||||||||
boolean |
removeOnDocumentSavedListener(PdfThumbnailGrid.OnDocumentSavedListener onDocumentSavedListener)
Removes a listener from the list of registered onDocumentSaved listeners
| ||||||||||
boolean |
removeOnDocumentSavedListener(PdfThumbnailGrid.OnPageClickListener onPageClickListener)
Removes a listener from the list of registered onPageClick listeners
| ||||||||||
void |
removeOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Unregister a previously registered
listener that no longer wants to receive
visibility change events. | ||||||||||
void |
setBackgroundColor(int backgroundColor)
Sets the background color of the thumbnail grid.
| ||||||||||
void |
setDocument(PdfDocument document, PdfConfiguration configuration)
Called when the
document has been loaded and is going to be displayed. | ||||||||||
void |
setDocumentEditorEnabled(boolean documentEditorEnabled)
Enables/Disables document editor.
| ||||||||||
void |
setDocumentEditorExportEnabled(boolean exportEnabled)
Enables/Disables document editor "Export pages" option in action bar.
| ||||||||||
void |
setDocumentEditorSaveAsEnabled(boolean saveAsEnabled)
Enables/Disables document editor "Save As" option in action bar.
| ||||||||||
void |
setFilePicker(FilePicker filePicker)
Sets a file picker to use during a saving process.
| ||||||||||
void |
setItemLabelBackground(int itemLabelBackgroundDrawableRes)
Sets the thumbnail grid background label background.
| ||||||||||
void |
setItemLabelTextStyle(int itemLabelTextStyle)
Sets the thumbnail grid item's label text style.
| ||||||||||
final void |
setNewPageFactory(NewPageFactory newPageFactory)
Sets a
NewPageFactory that will be used by the document editor. | ||||||||||
void |
setOnPageClickListener(PdfThumbnailGrid.OnPageClickListener onPageClickListener)
Sets the
PdfThumbnailGrid.OnPageClickListener , replacing any previously set listener. | ||||||||||
void |
setRedactionAnnotationPreviewEnabled(boolean enable)
Sets redaction annotations preview as redacted.
| ||||||||||
void |
setShowPageLabels(boolean showPageLabels)
Sets whether the page labels will be shown or just the page number.
| ||||||||||
void |
show()
Called by the activity when the view should make itself visible.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | fitSystemWindows(Rect insets) | ||||||||||
void | onDetachedFromWindow() | ||||||||||
Parcelable | onSaveInstanceState() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
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.
drawableProvider | PdfDrawableProvider whose drawable instances should be
managed (e.g. rendered on screen). |
---|
Adds a listener that will be notified about document saves inside the thumbnail grid.
onDocumentSavedListener | Listener for document saves after clicking on the "Save" and "Save As" button in the document editing toolbar. |
---|
Adds a listener that will be notified when a page on the ThumbnailGrid was clicked.
onPageClickListener | Listener to add. |
---|
Register a listener
that would like to receive visibility change events. Whenever
the visibility of a managed PSPDFKitViews.PSPDFView
changes, all registered listeners will be
notified.
listener | Listener to be added. |
---|
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.
Enters document editing mode.
Exits document editing mode.
Returns the background color of the thumbnail grid.
Returns The default NewPageDialog.Callback
that is used by default by the PdfThumbnailGrid
. Can be used to manually restore the NewPageDialog
when using a
custom DialogNewPageFactory
.
Returns document editor to perform operations such as page manipulation, reordering and importing documents.
Returns a file picker to use during a saving process. If not provided, a default implementation relying on Android Storage Access Framework will be returned. For more info about Android Storage Access Framework see Open files using storage access framework.
Returns the thumbnail grid background label background.
Returns the thumbnail grid item's label text style.
Returns the current type of this view.
PSPDFKitViews.Type
.
Retrieves the currently selected pages of the thumbnail grid.
Called by the activity when the view should hide itself.
Called when the activity needs to know the visibility of this view. Returns true
if this view is visible, otherwise returns false
.
Returns redaction annotation preview mode, false
by default.
true
if redaction annotation preview mode is enabled, false
otherwise.
Returns true
if page labels are shown, false
otherwise.
true
if page labels are shown, false
otherwise.
Called when the user taps / clicks on the document, not the page itself but on the side (if visible).
true
if tap is handled or false
if PSPDFKit should execute it's
default action.
Called if document loading has failed.
exception | Cause of the loading failure. |
---|
Called when document is successfully loaded and the document view has been laid out. This has to be called on the main thread.
document | Loaded document instance. |
---|
Called before document will be saved. This callback allows cancellation of the save process.
document | Instance of document to be saved. |
---|---|
saveOptions | Save options to be applied to the document. You may change parameters on this object to control how document is saved. |
true
if the document should be saved, false
if saving should be
cancelled.
Called if document saving has been cancelled.
document | Instance of document that was saved. |
---|
Called if document saving has failed.
exception | Cause of the saving failure if applicable. |
---|
Called after the document has been saved.
document | Instance of document that was saved. |
---|
Called when a user zooms a document.
document | Current document. |
---|---|
pageIndex | The number of the page that the was zoomed. |
scaleFactor | The current scale factor. |
Called when user scrolled to a new page.
document | Currently opened document. |
---|---|
pageIndex | Page number of new page. |
Called when user taps / clicks on the page.
document | Currently opened document. |
---|---|
pageIndex | Page number of the page being tapped. |
event | MotionEvent that triggered this page click. May be null if this
page click was triggered from keyboard or accessibility event. |
pagePosition | Tapped page position (in PDF page coordinates with origin on bottom
left). Coordinates passed here may exceed the page size (which is returned by getPageSize(int) ) and can also be negative. If the click was triggered by
the keyboard, pagePosition will be null . |
clickedAnnotation | Annotation that was tapped, or null if no annotation was
tapped. |
true
if tap was handled by this DocumentListener
and should not be
handled by PSPDFKit anymore. If returning false
PSPDFKit will continue executing
it's default action.
Called when content of page with pageIndex has changed (for example due to annotation or form field being updated). All views displaying this page need to refresh.
pageIndex | Page index of the updated page. Page index is 0-based. |
---|
Removes a previously added PdfDrawableProvider
. If the provider hasn't been added
previously, this method will be a no-op.
drawableProvider | PdfDrawableProvider that should be removed. Must be non-null. |
---|
Removes a listener from the list of registered onDocumentSaved listeners
onDocumentSavedListener | Listener to remove |
---|
Removes a listener from the list of registered onPageClick listeners
onPageClickListener | Listener to remove |
---|
Unregister a previously registered listener
that no longer wants to receive
visibility change events.
listener | Listener to be removed. |
---|
Sets the background color of the thumbnail grid.
backgroundColor | Thumbnail grid background color. |
---|
Called when the document
has been loaded and is going to be displayed. This has
to be called on the main thread.
document | Loaded PdfDocument . |
---|---|
configuration | Containing document and presentation settings. |
Enables/Disables document editor. This should be set before displaying PdfThumbnailGrid
. If enabled, a floating action button will be displayed, through which a
document editing mode can be entered.
documentEditorEnabled | true to enable document editing mode, false to
disable it.
|
---|
Enables/Disables document editor "Export pages" option in action bar.
exportEnabled | true to enable document editing page export option, false to disable it.
|
---|
Enables/Disables document editor "Save As" option in action bar. If disabled, clicking on Done button will overwrite the document automatically.
saveAsEnabled | true to enable document editing "Save As" option, false
to disable it.
|
---|
Sets a file picker to use during a saving process. If not provided, a default implementation relying on Android Storage Access Framework will be used. For more info about Android Storage Access Framework see Open files using storage access framework.
filePicker | File picker to use during a saving process. |
---|
Sets the thumbnail grid background label background.
itemLabelBackgroundDrawableRes | Thumbnail grid background label background resource drawable. |
---|
Sets the thumbnail grid item's label text style.
itemLabelTextStyle | Style resource for the item label. |
---|
Sets a NewPageFactory
that will be used by the document editor. The factory will be
called every time the user wants to add a new page to the edited document. Setting it to
null
will tell the document editor to use the default factory (which is using a page
creation dialog).
Note: When setting a factory this must be done each time the activity is recreated, since it won't be retained.
newPageFactory | Factory that will return NewPage instances for the document editor.
|
---|
Sets the PdfThumbnailGrid.OnPageClickListener
, replacing any previously set listener.
onPageClickListener | PdfThumbnailGrid.OnPageClickListener for receiving events of this view.
Use addOnPageClickListener(OnPageClickListener) instead.
|
---|
Sets redaction annotations preview as redacted.
enable | true to show redaction annotations as redacted, false to show
them as marks.
|
---|
Sets whether the page labels will be shown or just the page number.
showPageLabels | whether to show page labels or just the page number. |
---|
Called by the activity when the view should make itself visible.