Class PdfThumbnailBar
-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,com.pspdfkit.ui.PSPDFKitViews.PSPDFView
,com.pspdfkit.ui.drawable.PdfDrawableManager
public class PdfThumbnailBar extends PdfFrameLayout implements PSPDFKitViews.PSPDFView, PdfDrawableManager
Bar showing thumbnails of pages for quick selection. This class is basically a wrapper view around the actual thumbnail bar implementations, like PdfStaticThumbnailBar and . It will handle all the logic for thumbnail bar implementations so it's recommended that you use it directly, if adding thumbnail bar as a component to your custom layout. To select the thumbnail bar mode/style, use setThumbnailBarMode method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
PdfThumbnailBar.OnPageChangedListener
Listener for receiving page changes caused by the user touching or dragging the .
public final class
PdfThumbnailBar.ConvertToDrawable
Reactive function that converts a Bitmap to a Drawable with fade effect if needed.
-
Constructor Summary
Constructors Constructor Description PdfThumbnailBar(Context context)
PdfThumbnailBar(Context context, AttributeSet attrs)
PdfThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr)
PdfThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
Method Summary
Modifier and Type Method Description void
addDrawableProvider(@NonNull() PdfDrawableProvider drawableProvider)
Adds a PdfDrawableProvider to be managed by this object. void
removeDrawableProvider(@NonNull() PdfDrawableProvider drawableProvider)
Removes a previously added PdfDrawableProvider. 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. 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
getThumbnailBorderColor()
Returns the border color for the thumbnails in the thumbnail bar. void
setThumbnailBorderColor(@ColorInt() int borderColor)
Sets 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. void
setBackgroundColor(@ColorInt() int backgroundColor)
Sets the background color for the thumbnail bar. DocumentListener
getDocumentListener()
boolean
isRedactionAnnotationPreviewEnabled()
Returns whether the redaction annotation preview mode is enabled or not. void
setRedactionAnnotationPreviewEnabled(boolean enable)
Enables or disables redaction annotation preview mode. 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 PdfThumbnailBar. void
hide()
No-op for PdfThumbnailBar. 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. boolean
isBackgroundTransparent()
boolean
dispatchTouchEvent(MotionEvent ev)
final void
setOnPageChangedListener(@Nullable() PdfThumbnailBar.OnPageChangedListener onPageChangedListener)
Register a listener that is notified whenever the user changed the page on the thumbnail bar. void
setThumbnailBarMode(@NonNull() ThumbnailBarMode thumbnailBarMode)
Sets thumbnail bar mode whether static or scrollable. -
-
Constructor Detail
-
PdfThumbnailBar
PdfThumbnailBar(Context context)
-
PdfThumbnailBar
PdfThumbnailBar(Context context, AttributeSet attrs)
-
PdfThumbnailBar
PdfThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr)
-
PdfThumbnailBar
PdfThumbnailBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
-
Method Detail
-
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.
-
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.
-
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.
-
getThumbnailBorderColor
@ColorInt() int getThumbnailBorderColor()
Returns the border color for the thumbnails in the thumbnail bar.
- Returns:
Border colors of thumbnails.
-
setThumbnailBorderColor
void setThumbnailBorderColor(@ColorInt() int borderColor)
Sets the border color for the thumbnails in the thumbnail bar.
- Parameters:
borderColor
- 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.
-
setBackgroundColor
void setBackgroundColor(@ColorInt() int backgroundColor)
Sets the background color for the thumbnail bar.
- Parameters:
backgroundColor
- Thumbnail bar background color.
-
getDocumentListener
@NonNull() DocumentListener getDocumentListener()
-
isRedactionAnnotationPreviewEnabled
boolean isRedactionAnnotationPreviewEnabled()
Returns whether the redaction annotation preview mode is enabled or not.
- Returns:
true
if redaction annotation preview mode is enabled,false
otherwise.
-
setRedactionAnnotationPreviewEnabled
void setRedactionAnnotationPreviewEnabled(boolean enable)
Enables or disables redaction annotation preview mode.
- Parameters:
enable
-true
to show redaction annotations as redacted,false
to show them as marks.
-
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 PdfThumbnailBar.
-
hide
void hide()
No-op for PdfThumbnailBar.
-
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.
-
isBackgroundTransparent
boolean isBackgroundTransparent()
-
dispatchTouchEvent
boolean dispatchTouchEvent(MotionEvent ev)
-
setOnPageChangedListener
final void setOnPageChangedListener(@Nullable() PdfThumbnailBar.OnPageChangedListener onPageChangedListener)
Register a listener that is notified whenever the user changed the page on the thumbnail bar.
- Parameters:
onPageChangedListener
- Listener to be registered.
-
setThumbnailBarMode
void setThumbnailBarMode(@NonNull() ThumbnailBarMode thumbnailBarMode)
Sets thumbnail bar mode whether static or scrollable.
- Parameters:
thumbnailBarMode
- Thumbnail bar mode to set.
-
-
-
-