java.lang.Object | |
↳ | com.pspdfkit.ui.overlay.OverlayViewProvider |
Base class for classes that can return a list of views that should be drawn on top of the document.
Using this API requires the current license to contain the annotations component.
This class is still in experimental state meaning that it is tested and contains no known bugs, but the API might be changed or removed with any minor release.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | OverlayViewProvider.OverlayViewProviderObserver | An observer interested in changes to the underlying set of views. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final Set<Integer> | ALL_PAGES | If returned inside getPagesWithViews() ()} the overlay view provider won't be
limited to certain pages. |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
OverlayViewProvider()
Creates a new
OverlayViewProvider . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addOverlayViewProviderObserver(OverlayViewProvider.OverlayViewProviderObserver overlayViewProviderObserver)
Register a
OverlayViewProvider.OverlayViewProviderObserver to be notified of changes of provided views. | ||||||||||
final Set<Integer> |
getFilteredPages()
By overriding this method subclasses can define a set of page numbers for which drawables are
available.
| ||||||||||
Set<Integer> |
getPagesWithViews()
By overriding this method subclasses can define a set of page numbers for which views are
available.
| ||||||||||
abstract List<View> |
getViewsForPage(Context context, PdfDocument document, int pageIndex)
Returns all views for the given
document and pageIndex . | ||||||||||
void |
notifyOverlayViewsChanged(int pageIndex)
Notifies all registered
OverlayViewProvider.OverlayViewProviderObserver instances that the views for the
given pageIndex have changed and need to be removed and added again. | ||||||||||
void |
notifyOverlayViewsChanged()
Notifies all registered
OverlayViewProvider.OverlayViewProviderObserver instances that the views have
changed and need to be removed and added again. | ||||||||||
void |
onViewsHidden(int pageIndex, List<View> views)
Called when views that have been previously returned by
getViewsForPage(Context, PdfDocument, int) have become hidden because the hosting page has become hidden. | ||||||||||
void |
onViewsRecycled(int pageIndex, List<View> views)
Called when views that have been previously returned by
getViewsForPage(Context, PdfDocument, int) have been recycled because their hosting page was recycled. | ||||||||||
void |
onViewsShown(int pageIndex, List<View> views)
Called when views that have been previously returned by
getViewsForPage(Context, PdfDocument, int) have become visible because the hosting page has become visible. | ||||||||||
void |
removeOverlayViewProviderObserver(OverlayViewProvider.OverlayViewProviderObserver overlayViewProviderObserver)
Unregister a previously registered
OverlayViewProvider.OverlayViewProviderObserver so it won't receive
any future changes of provided views. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
If returned inside getPagesWithViews()
()} the overlay view provider won't be
limited to certain pages.
Creates a new OverlayViewProvider
.
InvalidPSPDFKitLicenseException | If the current license doesn't contain the annotations component. |
---|
Register a OverlayViewProvider.OverlayViewProviderObserver
to be notified of changes of provided views.
This observer is notified whenever notifyOverlayViewsChanged()
is called. If the
observer has been registered previously, a call to this method is a no-op.
overlayViewProviderObserver | An observer to be notified of changes whe notifyOverlayViewsChanged() is called.
|
---|
By overriding this method subclasses can define a set of page numbers for which drawables are available.
By overriding this method subclasses can define a set of page numbers for which views are
available. The default implementation returns ALL_PAGES
which will cause PSPDFKit to
ask the provider every time page views are required, independent of the page number. Consider
overriding this method if the loaded document has many pages, but only a few of them contain
views.
Returns all views for the given document
and pageIndex
. The framework will
only call this from the main thread.
context | The current activity hosting the document the view will be overlaid on. |
---|---|
document | The currently loaded PdfDocument . |
pageIndex | Number of the page for which the views should be returned. |
null
if no views should
be added.IllegalArgumentException | If the views to be attached have no layout parameters or
layout parameters that aren't of type OverlayLayoutParams .
|
---|
Notifies all registered OverlayViewProvider.OverlayViewProviderObserver
instances that the views for the
given pageIndex
have changed and need to be removed and added again.
Call this when the set of views has changed, if you only want to change the positioning of
the the views simply update their OverlayLayoutParams
.
pageIndex | Number of the page on which views have changed. |
---|
Notifies all registered OverlayViewProvider.OverlayViewProviderObserver
instances that the views have
changed and need to be removed and added again. If only views for a single page have changed,
consider calling notifyOverlayViewsChanged(int)
instead.
Call this when the set of views has changed, if you only want to change the positioning of
the the views simply update their OverlayLayoutParams
.
Called when views that have been previously returned by getViewsForPage(Context, PdfDocument, int)
have become hidden because the hosting page has become hidden.
pageIndex | The page for which the views became hidden. |
---|---|
views | The views that have become hidden. |
Called when views that have been previously returned by getViewsForPage(Context, PdfDocument, int)
have been recycled because their hosting page was recycled.
pageIndex | The page for which the views were recycled. |
---|---|
views | The views that were recycled. These views are no longer part of the view hierarchy and can be reused again. |
Called when views that have been previously returned by getViewsForPage(Context, PdfDocument, int)
have become visible because the hosting page has become visible.
pageIndex | The page for which the views became visible. |
---|---|
views | The views that have become visible. |
Unregister a previously registered OverlayViewProvider.OverlayViewProviderObserver
so it won't receive
any future changes of provided views.
overlayViewProviderObserver | An observer to unregister from change notifications. |
---|