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() PdfFragment fragment, @NonNull() ScrollState state)
Called whenever the current scroll state of the PdfFragment changed. final void
onDocumentScrolled(@NonNull() PdfFragment fragment, int currX, int currY, int maxX, int maxY, int extendX, int extendY)
Called whenever the document in the fragment scrolled. 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() PdfFragment fragment, @NonNull() ScrollState state)
Called whenever the current scroll state of the PdfFragment changed.
- Parameters:
fragment
- PdfFragment whose scroll state changed.state
- The new scroll state.
-
onDocumentScrolled
final void onDocumentScrolled(@NonNull() PdfFragment fragment, 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:
fragment
- The scrolled PdfFragment.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.
-
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.
-
-
-
-