Class VerticalScrollBar
-
- 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.scrolling.DocumentScrollListener
public class VerticalScrollBar extends ViewGroup implements DocumentScrollListener
Provides a vertical scroll indicator that can be dragged to change pages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
VerticalScrollBar.OnPageChangeListener
Interface for a listener that is notified of scrollbar page change events.
-
Constructor Summary
Constructors Constructor Description VerticalScrollBar(Context context)
VerticalScrollBar(Context context, AttributeSet attrs)
VerticalScrollBar(Context context, AttributeSet attrs, int defStyleAttr)
-
Method Summary
Modifier and Type Method Description final void
awakenScrollBar()
Manually shows the scroll indicator, hiding it after some time. final void
setDocument(@NonNull() PdfDocument document)
Sets the document that provides page count for this scrollbar. final void
setScrollDirection(@NonNull() PageScrollDirection pageScrollDirection)
Sets the scroll direction that is configured on the PdfFragment. final boolean
onTouchEvent(@NonNull() MotionEvent ev)
final void
onScrollStateChanged(@NonNull() ScrollState state)
Called whenever the current scroll state of the document view has changed. final void
onDocumentScrolled(int currX, int currY, int maxX, int maxY, int extendX, int extendY)
Called whenever the document in the fragment scrolled. void
setAutoHide(boolean enable)
This controls if the scrollbar can auto hide or stay visible all the time. final void
setOnPageChangeListener(@Nullable() VerticalScrollBar.OnPageChangeListener onPageChangeListener)
Sets the OnPageChangeListener that will be notified of future page change events. -
-
Constructor Detail
-
VerticalScrollBar
VerticalScrollBar(Context context)
-
VerticalScrollBar
VerticalScrollBar(Context context, AttributeSet attrs)
-
VerticalScrollBar
VerticalScrollBar(Context context, AttributeSet attrs, int defStyleAttr)
-
-
Method Detail
-
awakenScrollBar
final void awakenScrollBar()
Manually shows the scroll indicator, hiding it after some time.
-
setDocument
final void setDocument(@NonNull() PdfDocument document)
Sets the document that provides page count for this scrollbar.
- Parameters:
document
- A PdfDocument providing the page count for this view.
-
setScrollDirection
final void setScrollDirection(@NonNull() PageScrollDirection pageScrollDirection)
Sets the scroll direction that is configured on the PdfFragment. This is required to let this view consume the correct scroll values.
- Parameters:
pageScrollDirection
- A PageScrollDirection value.
-
onTouchEvent
final boolean onTouchEvent(@NonNull() MotionEvent ev)
-
onScrollStateChanged
final void onScrollStateChanged(@NonNull() ScrollState state)
Called whenever the current scroll state of the document view has changed.
- Parameters:
state
- The new scroll state.
-
onDocumentScrolled
final void onDocumentScrolled(int currX, int currY, int maxX, int maxY, int extendX, int extendY)
Called whenever the document in the fragment scrolled. Values are expressed in an arbitrary unit and may change with every call. Also
maxX
andmaxY
are not guaranteed to remain the same between two calls.- Parameters:
currX
- Current scroll amount X.currY
- Current scroll amount Y.maxX
- Maximum scroll amount of the X dimension.maxY
- Maximum scroll amount of the Y dimension.extendX
- Extend of the visible content in the X dimension.extendY
- Extend of the visible content in the Y dimension.
-
setAutoHide
void setAutoHide(boolean enable)
This controls if the scrollbar can auto hide or stay visible all the time.
- Parameters:
enable
- boolean to enable/disable auto hide.
-
setOnPageChangeListener
final void setOnPageChangeListener(@Nullable() VerticalScrollBar.OnPageChangeListener onPageChangeListener)
Sets the OnPageChangeListener that will be notified of future page change events. Providing
null
will remove any previously set listener.- Parameters:
onPageChangeListener
- A OnPageChangeListener to be notified of page change events, ornull
to remove a previously set listener.
-
-
-
-