public class

VerticalScrollBar

extends ViewGroup
implements DocumentScrollListener
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.pspdfkit.ui.scrollbar.VerticalScrollBar

Class Overview

Provides a vertical scroll indicator that can be dragged to change pages.

Summary

Nested Classes
interface VerticalScrollBar.OnPageChangeListener Interface for a listener that is notified of scrollbar page change events. 
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
VerticalScrollBar(Context context)
VerticalScrollBar(Context context, AttributeSet attrs)
VerticalScrollBar(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
final void awakenScrollBar()
Manually shows the scroll indicator, hiding it after some time.
final void onDocumentScrolled(PdfFragment fragment, int currX, int currY, int maxX, int maxY, int extendX, int extendY)
Called whenever the document in the fragment scrolled.
final void onScrollStateChanged(PdfFragment fragment, ScrollState state)
Called whenever the current scroll state of the PdfFragment changed.
final boolean onTouchEvent(MotionEvent ev)
final void setDocument(PdfDocument document)
Set the document that provides page count for this scrollbar.
final void setOnPageChangeListener(VerticalScrollBar.OnPageChangeListener onPageChangeListener)
Sets the VerticalScrollBar.OnPageChangeListener that will be notified of future page change events.
final void setScrollDirection(PageScrollDirection pageScrollDirection)
Sets the scroll direction that is configured on the PdfFragment.
Protected Methods
View onCreateScrollIndicator()
Creates the view used as scroll indicator and drag handle.
void onDocumentSet(PdfDocument document)
Called by this view whenever a new PdfDocument has been set.
void onHideScrollIndicator(View scrollIndicatorView)
Called by the scrollbar when the indicator should be hidden.
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void onScrollIndicatorDragStarted(View scrollIndicatorView)
Called when the user touched the scroll indicator.
void onScrollIndicatorDragStopped(View scrollIndicatorView)
Called when the user raised the finger and released the scroll indicator.
void onShowScrollIndicator(View scrollIndicatorView)
Called by the scrollbar when the indicator should be shown.
[Expand]
Inherited Methods
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource
From interface com.pspdfkit.listeners.scrolling.DocumentScrollListener

Public Constructors

public VerticalScrollBar (Context context)

public VerticalScrollBar (Context context, AttributeSet attrs)

public VerticalScrollBar (Context context, AttributeSet attrs, int defStyleAttr)

Public Methods

public final void awakenScrollBar ()

Manually shows the scroll indicator, hiding it after some time.

public final void onDocumentScrolled (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 and maxY 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.

public final void onScrollStateChanged (PdfFragment fragment, ScrollState state)

Called whenever the current scroll state of the PdfFragment changed.

Parameters
fragment PdfFragment whose scroll state changed.
state The new scroll state.

public final boolean onTouchEvent (MotionEvent ev)

public final void setDocument (PdfDocument document)

Set the document that provides page count for this scrollbar.

Parameters
document A PdfDocument providing the page count for this view.

public final void setOnPageChangeListener (VerticalScrollBar.OnPageChangeListener onPageChangeListener)

Sets the VerticalScrollBar.OnPageChangeListener that will be notified of future page change events. Providing null will remove any previously set listener.

Parameters
onPageChangeListener A VerticalScrollBar.OnPageChangeListener to be notified of page change events, or null to remove a previously set listener.

public final void setScrollDirection (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. Defaults to VERTICAL.

Protected Methods

protected View onCreateScrollIndicator ()

Creates the view used as scroll indicator and drag handle. By default this returns an ImageView. Subclasses may override this method to provide their own view as indicator.

Returns
  • The view used as a drag handle.

protected void onDocumentSet (PdfDocument document)

Called by this view whenever a new PdfDocument has been set. Subclasses may override this method to prepare for the new document.

Parameters
document A PdfDocument that was set to this view.

protected void onHideScrollIndicator (View scrollIndicatorView)

Called by the scrollbar when the indicator should be hidden. By default this translates and blends out the indicator view. Subclasses may override this method to provide their own code for hiding the indicator.

Parameters
scrollIndicatorView The indicator view that should be hidden.

protected void onLayout (boolean changed, int l, int t, int r, int b)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected void onScrollIndicatorDragStarted (View scrollIndicatorView)

Called when the user touched the scroll indicator. This signifies that the user has started dragging the indicator.

Parameters
scrollIndicatorView The indicator view.

protected void onScrollIndicatorDragStopped (View scrollIndicatorView)

Called when the user raised the finger and released the scroll indicator. This signifies that the user has stopped dragging the indicator.

Parameters
scrollIndicatorView The indicator view.

protected void onShowScrollIndicator (View scrollIndicatorView)

Called by the scrollbar when the indicator should be shown. By default this translates and blends in the indicator view. Subclasses may override this method to provide their own code for showing the indicator.

Parameters
scrollIndicatorView The indicator view that should be shown.