Class PdfStaticThumbnailBar
-
- 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
public class PdfStaticThumbnailBar extends DocumentListenerViewGroup implements PSPDFKitViews.PSPDFView, PdfThumbnailBarController
Bar showing thumbnails of pages for quick selection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enum
PdfStaticThumbnailBar.LayoutStyle
A PdfStaticThumbnailBar has two possible layout styles, depending on how it's planned to be used.
-
Field Summary
Fields Modifier and Type Field Description public int
thumbnailHeight
public int
thumbnailWidth
public ImageView
leftSelectedImage
public PdfStaticThumbnailBar.LayoutStyle
layoutStyle
-
Constructor Summary
Constructors Constructor Description PdfStaticThumbnailBar(Context context)
PdfStaticThumbnailBar(Context context, AttributeSet attrs)
PdfStaticThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr)
PdfStaticThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
Method Summary
Modifier and Type Method Description int
getThumbnailHeight()
Returns the height of the thumbnails in thumbnail bar. void
setThumbnailHeight(@IntRange(from = 1) int thumbnailHeight)
Sets the height of the thumbnails in thumbnail bar. int
getThumbnailWidth()
Returns the width of the thumbnails in thumbnail bar. void
setThumbnailWidth(@IntRange(from = 1) int thumbnailWidth)
Sets the width of the thumbnails in thumbnail bar. ImageView
getLeftSelectedImage()
PdfStaticThumbnailBar.LayoutStyle
getLayoutStyle()
Gets layout style of this thumbnail bar. void
setLayoutStyle(@NonNull() PdfStaticThumbnailBar.LayoutStyle layoutStyle)
Sets layout style of the thumbnail bar. boolean
isBackgroundTransparent()
int
getBackgroundColor()
int
getThumbnailBorderColor()
Returns the border color for the thumbnails in the thumbnail bar. int
getSelectedThumbnailBorderColor()
Returns the border color for the selected thumbnail in the thumbnail bar. void
setSelectedThumbnailBorderColor(@ColorInt() int borderColor)
Sets the border color for the selected thumbnail in the thumbnail bar. boolean
isRedactionAnnotationPreviewEnabled()
Returns redaction annotation preview mode, false
by default.void
setThumbnailBorderColor(@ColorInt() int borderColor)
Sets the border color for the thumbnails in the thumbnail bar. boolean
isUsingPageAspectRatio()
Returns whether the page aspect ratio is used to determine the thumbnail width. void
setUsePageAspectRatio(boolean usePageAspectRatio)
Configures the thumbnail bar to use the page aspect ratio to calculate the thumbnail width. void
setBackgroundColor(@ColorInt() int backgroundColor)
DocumentListener
getDocumentListener()
boolean
onTouchEvent(@NonNull() MotionEvent event)
void
setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)
Called when the document
has been loaded and is going to be displayed.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
show()
No-op for PdfStaticThumbnailBar. void
hide()
No-op for PdfStaticThumbnailBar. void
clearDocument()
Called by the activity when the view should unbind the previously set document. boolean
isDisplayed()
Called when the activity needs to know the visibility of this view. PSPDFKitViews.Type
getPSPDFViewType()
Returns the current type of this view. void
onPageChanged(@NonNull() PdfDocument document, int pageIndex)
Called when user scrolled to a new page. 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). boolean
onInterceptTouchEvent(MotionEvent ev)
int
getThumbnailOffsetX(@IntRange(from = 0) int pageIndex)
View
focusSearch(@NonNull() View focused, int direction)
void
setOnPageChangedListener(@Nullable() PdfThumbnailBar.OnPageChangedListener onPageChangedListener)
Sets a listener to be notified of page changing events. void
setRedactionAnnotationPreviewEnabled(boolean enable)
Sets redaction annotations preview as redacted. void
setDrawableProviders(List<PdfDrawableProvider> drawableProviders)
Sets PdfDrawableProviders to provide custom PdfDrawable to be displayed in a thumbnail bar page items. -
-
Constructor Detail
-
PdfStaticThumbnailBar
PdfStaticThumbnailBar(Context context)
-
PdfStaticThumbnailBar
PdfStaticThumbnailBar(Context context, AttributeSet attrs)
-
PdfStaticThumbnailBar
PdfStaticThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr)
-
PdfStaticThumbnailBar
PdfStaticThumbnailBar(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.
-
getLeftSelectedImage
@Nullable() ImageView getLeftSelectedImage()
-
getLayoutStyle
@NonNull() PdfStaticThumbnailBar.LayoutStyle getLayoutStyle()
Gets layout style of this thumbnail bar.
- Returns:
Layout style used in this thumbnail bar.
-
setLayoutStyle
void setLayoutStyle(@NonNull() PdfStaticThumbnailBar.LayoutStyle layoutStyle)
Sets layout style of the thumbnail bar.
- Parameters:
layoutStyle
- Layout style to be set on this thumbnail bar.
-
isBackgroundTransparent
boolean isBackgroundTransparent()
-
getBackgroundColor
@ColorInt() int getBackgroundColor()
-
getThumbnailBorderColor
@ColorInt() int getThumbnailBorderColor()
Returns the border color for the thumbnails in the thumbnail bar.
- Returns:
Border colors of thumbnails.
-
getSelectedThumbnailBorderColor
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.
-
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.
-
setBackgroundColor
void setBackgroundColor(@ColorInt() int backgroundColor)
-
getDocumentListener
@NonNull() DocumentListener getDocumentListener()
-
onTouchEvent
boolean onTouchEvent(@NonNull() MotionEvent event)
-
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.
-
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.
-
show
void show()
No-op for PdfStaticThumbnailBar.
-
hide
void hide()
No-op for PdfStaticThumbnailBar.
-
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 returnsfalse
.
-
getPSPDFViewType
@NonNull() PSPDFKitViews.Type getPSPDFViewType()
Returns the current type of this view.
- Returns:
Any of Type.
-
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.
-
onInterceptTouchEvent
boolean onInterceptTouchEvent(MotionEvent ev)
-
getThumbnailOffsetX
int getThumbnailOffsetX(@IntRange(from = 0) int pageIndex)
-
focusSearch
View focusSearch(@NonNull() View focused, int direction)
-
setOnPageChangedListener
void setOnPageChangedListener(@Nullable() PdfThumbnailBar.OnPageChangedListener onPageChangedListener)
Sets 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
- OnPageChangedListener that should be notified, ornull
to clear the listener.
-
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.
-
setDrawableProviders
void setDrawableProviders(List<PdfDrawableProvider> drawableProviders)
Sets PdfDrawableProviders to provide custom PdfDrawable to be displayed in a thumbnail bar page items.
-
-
-
-