Class PdfScrollableThumbnailBar

  • All Implemented Interfaces:
    android.graphics.drawable.Drawable.Callback , android.view.KeyEvent.Callback , android.view.ViewManager , android.view.ViewParent , android.view.accessibility.AccessibilityEventSource , com.pspdfkit.listeners.DocumentListener , com.pspdfkit.ui.PSPDFKitViews.PSPDFView , com.pspdfkit.ui.thumbnail.PdfThumbnailBarController , com.pspdfkit.ui.thumbnail.ThumbnailAdapter.OnThumbnailClickListener

    
    public class PdfScrollableThumbnailBar
    extends DocumentListenerViewGroup implements PSPDFKitViews.PSPDFView, ThumbnailAdapter.OnThumbnailClickListener, PdfThumbnailBarController
                        

    Scrollable bar showing thumbnails of pages, with larger images.

    • Constructor Detail

      • PdfScrollableThumbnailBar

        PdfScrollableThumbnailBar(Context context)
      • PdfScrollableThumbnailBar

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

        PdfScrollableThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
    • Method Detail

      • getThumbnailHeight

        @IntRange(from = 1) int getThumbnailHeight()

        Returns the height of the thumbnails in thumbnail bar.

        Returns:

        Height of thumbnails in pixels.

      • setThumbnailHeight

         void setThumbnailHeight(@IntRange(from = 1) int thumbnailHeight)

        Sets the height of the thumbnails in thumbnail bar.

        Parameters:
        thumbnailHeight - Height of thumbnails in pixels.
      • getThumbnailWidth

        @IntRange(from = 1) int getThumbnailWidth()

        Returns the width of the thumbnails in thumbnail bar. In the case where isUsingPageAspectRatio is true this will return the actual width of the first thumbnail.

        Returns:

        Width of thumbnails in pixels.

      • setThumbnailWidth

         void setThumbnailWidth(@IntRange(from = 1) 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.
      • getThumbnailBorderColor

        @ColorInt() int getThumbnailBorderColor()

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

        Returns:

        Border colors of thumbnails.

      • getSelectedThumbnailBorderColor

        @ColorInt() int getSelectedThumbnailBorderColor()

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

        Returns:

        Border colors of selected thumbnail.

      • setSelectedThumbnailBorderColor

         void setSelectedThumbnailBorderColor(@ColorInt() int borderColor)

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

        Parameters:
        borderColor - Border colors of selected thumbnail.
      • isRedactionAnnotationPreviewEnabled

         boolean isRedactionAnnotationPreviewEnabled()

        Returns redaction annotation preview mode, false by default.

        Returns:

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

      • setRedactionAnnotationPreviewEnabled

         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.
      • setThumbnailBorderColor

         void setThumbnailBorderColor(@ColorInt() int borderColor)

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

        Parameters:
        borderColor - Border colors of thumbnails.
      • isUsingPageAspectRatio

         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.

      • setUsePageAspectRatio

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

      • isDisplayed

         boolean isDisplayed()

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

      • onPageChanged

         void onPageChanged(@NonNull() PdfDocument document, int pageIndex)

        Called when user scrolled to a new page.

        Parameters:
        document - Currently opened document.
        pageIndex - Page number of new page.
      • onPageUpdated

         void onPageUpdated(@NonNull() PdfDocument document, @IntRange(from = 0) 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.
      • onThumbnailChanged

         void onThumbnailChanged(@NonNull() View view, @IntRange(from = 0) 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 before updating.

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