public class

PdfScrollableThumbnailBar

extends DocumentListenerViewGroup
implements PSPDFKitViews.PSPDFView PdfThumbnailBarController ThumbnailAdapter.OnThumbnailClickListener
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.pspdfkit.framework.views.utils.DocumentListenerViewGroup
         ↳ com.pspdfkit.ui.thumbnail.PdfScrollableThumbnailBar

Class Overview

Scrollable bar showing thumbnails of pages, with larger images.

Summary

[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
PdfScrollableThumbnailBar(Context context)
PdfScrollableThumbnailBar(Context context, AttributeSet attrs)
PdfScrollableThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr)
PdfScrollableThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
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.
int getBackgroundColor()
DocumentListener getDocumentListener()
int getItemCount()
PSPDFKitViews.Type getPSPDFViewType()
Returns the type of this view.
int getSelectedPage()
int getSelectedThumbnailBorderColor()
Returns the border color for the selected thumbnail in the thumbnail bar.
int getThumbnailBorderColor()
Returns the border color for the thumbnails in the thumbnail bar.
int getThumbnailHeight()
Returns the height of the thumbnails in thumbnail bar.
int getThumbnailWidth()
Returns the width of the thumbnails in thumbnail bar.
void hide()
boolean isBackgroundTransparent()
boolean isDisplayed()
Called when the activity needs to know the visibility of this view.
boolean isRedactionAnnotationPreviewEnabled()
Returns redaction annotation preview mode, false by default.
boolean isUsingPageAspectRatio()
Returns whether the page aspect ratio is used to determine the thumbnail width.
void onPageChanged(PdfDocument document, int pageIndex)
Called when user scrolled to a new 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 onThumbnailChanged(View view, int pageIndex)
Called whenever the user touched on a thumbnail, selecting a different page.
void removeOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Unregister a previously registered listener that no longer wants to receive visibility change events.
void setBackgroundColor(int color)
void setDocument(PdfDocument document, PdfConfiguration configuration)
Called when the document has been loaded and is going to be displayed.
void setDrawableProviders(List<PdfDrawableProvider> drawableProviders)
Sets PdfDrawableProviders to provide custom PdfDrawable to be displayed in a thumbnail bar page items.
void setOnPageChangedListener(PdfThumbnailBar.OnPageChangedListener onPageChangedListener)
Set a listener to be notified of page changing events.
void setRedactionAnnotationPreviewEnabled(boolean enable)
Sets redaction annotations preview as redacted.
void setSelectedThumbnailBorderColor(int borderColor)
Sets the border color for the selected thumbnail in the thumbnail bar.
void setThumbnailBorderColor(int borderColor)
Sets the border color for the thumbnails in the thumbnail bar.
void setThumbnailHeight(int thumbnailHeight)
Sets the height of the thumbnails in thumbnail bar.
void setThumbnailWidth(int thumbnailWidth)
Sets the width of the thumbnails in thumbnail bar.
void setUsePageAspectRatio(boolean usePageAspectRatio)
Configures the thumbnail bar to use the page aspect ratio to calculate the thumbnail width.
void show()
Protected Methods
boolean fitSystemWindows(Rect insets)
void onLayout(boolean changed, int left, int top, int right, int bottom)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void onRestoreInstanceState(Parcelable state)
Parcelable onSaveInstanceState()
void onSizeChanged(int w, int h, int oldw, int oldh)
[Expand]
Inherited Methods
From class com.pspdfkit.framework.views.utils.DocumentListenerViewGroup
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource
From interface com.pspdfkit.listeners.DocumentListener
From interface com.pspdfkit.ui.PSPDFKitViews.PSPDFView
From interface com.pspdfkit.ui.thumbnail.PdfThumbnailBarController
From interface com.pspdfkit.ui.thumbnail.ThumbnailAdapter.OnThumbnailClickListener

Public Constructors

public PdfScrollableThumbnailBar (Context context)

public PdfScrollableThumbnailBar (Context context, AttributeSet attrs)

public PdfScrollableThumbnailBar (Context context, AttributeSet attrs, int defStyleAttr)

public PdfScrollableThumbnailBar (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public Methods

public void addOnVisibilityChangedListener (OnVisibilityChangedListener listener)

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.

Parameters
listener Listener to be added.

public 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.

public int getBackgroundColor ()

public DocumentListener getDocumentListener ()

public int getItemCount ()

public PSPDFKitViews.Type getPSPDFViewType ()

Returns the type of this view.

Returns

public int getSelectedPage ()

public int getSelectedThumbnailBorderColor ()

Returns the border color for the selected thumbnail in the thumbnail bar.

Returns
  • Border colors of selected thumbnail.

public int getThumbnailBorderColor ()

Returns the border color for the thumbnails in the thumbnail bar.

Returns
  • Border colors of thumbnails.

public int getThumbnailHeight ()

Returns the height of the thumbnails in thumbnail bar.

Returns
  • Height of thumbnails in pixels.

public int getThumbnailWidth ()

Returns the width of the thumbnails in thumbnail bar.

Returns
  • Width of thumbnails in pixels.

public void hide ()

public boolean isBackgroundTransparent ()

public boolean isDisplayed ()

Called when the activity needs to know the visibility of this view. Returns true if this view is visible, otherwise returns false.

public boolean isRedactionAnnotationPreviewEnabled ()

Returns redaction annotation preview mode, false by default.

Returns
  • true if redaction annotation preview mode is enabled, false otherwise.

public boolean isUsingPageAspectRatio ()

Returns whether the page aspect ratio is used to determine the thumbnail width.

Returns
  • true if the thumbnail width is calculated based on the page aspect ratio and thumbnail height, false if the thumbnail width is used as configured.

public void onPageChanged (PdfDocument document, int pageIndex)

Called when user scrolled to a new page.

Parameters
document Currently opened document.
pageIndex Page number of new page.

public 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). All views displaying this page need to refresh.

Parameters
pageIndex Page index of the updated page. Page index is 0-based.

public void onThumbnailChanged (View view, int pageIndex)

Called whenever the user touched on a thumbnail, selecting a different page. The thumbnail bar won't update its internal state (i.e. the currently shown highlighted page) after calling this method, but will wait for a subsequent call to onPageChanged(PdfDocument, int) before updating.

Parameters
view View that triggered this event.
pageIndex Number of the selected page.

public void removeOnVisibilityChangedListener (OnVisibilityChangedListener listener)

Unregister a previously registered listener that no longer wants to receive visibility change events.

Parameters
listener Listener to be removed.

public void setBackgroundColor (int color)

public void setDocument (PdfDocument document, 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.

public void setDrawableProviders (List<PdfDrawableProvider> drawableProviders)

Sets PdfDrawableProviders to provide custom PdfDrawable to be displayed in a thumbnail bar page items.

public void setOnPageChangedListener (PdfThumbnailBar.OnPageChangedListener onPageChangedListener)

Set a listener to be notified of page changing events. Calling this method will replace any previously set listener. You may provide null to clear the listener.

Parameters
onPageChangedListener PdfThumbnailBar.OnPageChangedListener that should be notified, or null to clear the listener.

public void setRedactionAnnotationPreviewEnabled (boolean enable)

Sets redaction annotations preview as redacted.

Parameters
enable true to show redaction annotations as redacted, false to show them as marks.

public void setSelectedThumbnailBorderColor (int borderColor)

Sets the border color for the selected thumbnail in the thumbnail bar.

Parameters
borderColor Border colors of selected thumbnail.

public void setThumbnailBorderColor (int borderColor)

Sets the border color for the thumbnails in the thumbnail bar.

Parameters
borderColor Border colors of thumbnails.

public void setThumbnailHeight (int thumbnailHeight)

Sets the height of the thumbnails in thumbnail bar.

Parameters
thumbnailHeight Height of thumbnails in pixels.

public void setThumbnailWidth (int thumbnailWidth)

Sets the width of the thumbnails in thumbnail bar. This has no effect if isUsingPageAspectRatio() is set to true.

Parameters
thumbnailWidth Width of thumbnails in pixels.

public void setUsePageAspectRatio (boolean usePageAspectRatio)

Configures the thumbnail bar to use the page aspect ratio to calculate the thumbnail width.

Parameters
usePageAspectRatio true to automatically calculate the thumbnail width based on the page aspect ratio and thumbnail height, false to use the configured thumbnail width.

public void show ()

Protected Methods

protected boolean fitSystemWindows (Rect insets)

protected void onLayout (boolean changed, int left, int top, int right, int bottom)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected void onRestoreInstanceState (Parcelable state)

protected Parcelable onSaveInstanceState ()

protected void onSizeChanged (int w, int h, int oldw, int oldh)