com.pspdfkit.ui.DocumentCoordinator |
Coordinates loading and display of multiple documents in PdfActivity
. Use
it to modify the list of loaded documents and to switch between them.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | DocumentCoordinator.OnDocumentCoordinatorEmptyListener | Listener for the last document being removed from the DocumentCoordinator . |
|||||||||
interface | DocumentCoordinator.OnDocumentVisibleListener | Listener for document becoming visible in the DocumentCoordinator . |
|||||||||
interface | DocumentCoordinator.OnDocumentsChangedListener | Listener for changes made to documents managed by DocumentCoordinator . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract boolean |
addDocument(DocumentDescriptor documentDescriptor, int index)
Inserts a new document at the specified index.
| ||||||||||
abstract boolean |
addDocument(DocumentDescriptor documentDescriptor)
Inserts a new document at the end of the documents list.
| ||||||||||
abstract boolean |
addDocumentAfterVisibleDocument(DocumentDescriptor documentDescriptor)
Inserts a document after the current visible document.
| ||||||||||
abstract void |
addOnDocumentCoordinatorEmptyListener(DocumentCoordinator.OnDocumentCoordinatorEmptyListener listener)
Registers a
DocumentCoordinator.OnDocumentCoordinatorEmptyListener to get notified when document gets
visible in the manager. | ||||||||||
abstract void |
addOnDocumentVisibleListener(DocumentCoordinator.OnDocumentVisibleListener listener)
Registers a
DocumentCoordinator.OnDocumentVisibleListener to get notified when document gets visible in
the manager. | ||||||||||
abstract void |
addOnDocumentsChangedListener(DocumentCoordinator.OnDocumentsChangedListener listener)
Registers a
DocumentCoordinator.OnDocumentsChangedListener to get notified when items in document
coordinator change. | ||||||||||
abstract List<DocumentDescriptor> |
getDocuments()
Returns all documents managed by this coordinator.
| ||||||||||
abstract DocumentDescriptor |
getVisibleDocument()
Returns currently visible document (if any).
| ||||||||||
abstract boolean |
moveDocument(DocumentDescriptor documentToMove, int targetIndex)
Moves documents in the document list to specified position.
| ||||||||||
abstract boolean |
removeAllDocuments()
Removes all documents managed by this coordinator.
| ||||||||||
abstract boolean |
removeAllDocumentsExceptVisible()
Removes all documents managed by this coordinator except for the currently visible one.
| ||||||||||
abstract boolean |
removeDocument(DocumentDescriptor documentDescriptor)
Removes the document if it's managed by this coordinator.
| ||||||||||
abstract void |
removeOnDocumentCoordinatorEmptyListener(DocumentCoordinator.OnDocumentCoordinatorEmptyListener listener)
Removes a previously registered
DocumentCoordinator.OnDocumentCoordinatorEmptyListener . | ||||||||||
abstract void |
removeOnDocumentVisibleListener(DocumentCoordinator.OnDocumentVisibleListener listener)
Removes a previously registered
DocumentCoordinator.OnDocumentVisibleListener . | ||||||||||
abstract void |
removeOnDocumentsChangedListener(DocumentCoordinator.OnDocumentsChangedListener listener)
Removes a previously registered
DocumentCoordinator.OnDocumentsChangedListener . | ||||||||||
abstract boolean |
setDocument(DocumentDescriptor documentDescriptor)
Replaces currently visible document with another document.
| ||||||||||
abstract boolean |
setVisibleDocument(DocumentDescriptor visibleDocument)
Changes currently visible document.
|
Inserts a new document at the specified index. If the document already exists, it will not be added again or moved.
The document is not made visible by this method, use setVisibleDocument(DocumentDescriptor)
to make it visible.
documentDescriptor | Document to add. |
---|---|
index | Index at which the document should be inserted. |
true
when documents list has changed.
Inserts a new document at the end of the documents list. If the document already exists, it will not be added again or moved.
The document is not made visible by this method, use setVisibleDocument(DocumentDescriptor)
to make it visible.
documentDescriptor | Document to add. |
---|
true
when documents list has changed.
Inserts a document after the current visible document. If the document already exists, it will not be added again or moved. This method is a no-op if no document is visible.
The document is not made visible by this method, use setVisibleDocument(DocumentDescriptor)
to make it visible.
documentDescriptor | Document to add. |
---|
true
when documents list has changed.
Registers a DocumentCoordinator.OnDocumentCoordinatorEmptyListener
to get notified when document gets
visible in the manager. If the listener has been registered previously, this method will be a
no-op.
listener | Listener to register. Must be non-null. |
---|
Registers a DocumentCoordinator.OnDocumentVisibleListener
to get notified when document gets visible in
the manager. If the listener has been registered previously, this method will be a no-op.
listener | Listener to register. Must be non-null. |
---|
Registers a DocumentCoordinator.OnDocumentsChangedListener
to get notified when items in document
coordinator change. If the listener has been registered previously, this method will be a
no-op.
listener | Listener to register. Must be non-null. |
---|
Returns all documents managed by this coordinator.
Returns currently visible document (if any).
null
if no document is currently
visible.
Moves documents in the document list to specified position.
documentToMove | Document to move. |
---|---|
targetIndex | Index in documents list to which the document should be moved. |
true
when documents list has changed.
Removes all documents managed by this coordinator.
true
when the document list has changed.
Removes all documents managed by this coordinator except for the currently visible one.
true
when the document list has changed.
Removes the document if it's managed by this coordinator. Next visible document will be shown after removing currently visible document.
documentDescriptor | Document to remove. |
---|
true
when documents list has changed.IllegalStateException | if not called on the UI thread |
---|
Removes a previously registered DocumentCoordinator.OnDocumentCoordinatorEmptyListener
. If the listener
hasn't been registered previously, this method will be a no-op.
listener | Listener to unregister. Must be non-null. |
---|
Removes a previously registered DocumentCoordinator.OnDocumentVisibleListener
. If the listener hasn't
been registered previously, this method will be a no-op.
listener | Listener to unregister. Must be non-null. |
---|
Removes a previously registered DocumentCoordinator.OnDocumentsChangedListener
. If the listener hasn't
been registered previously, this method will be a no-op.
listener | Listener to unregister. Must be non-null. |
---|
Replaces currently visible document with another document. Making this document visible immediately.
This method may only be called if onSaveInstanceState(Bundle)
has not
been called or an exception will be thrown, since after that call state loss could occur.
documentDescriptor | Document to add. |
---|
true
when documents list has changed.
Changes currently visible document.
This method may only be called if onSaveInstanceState(Bundle)
has not
been called or an exception will be thrown, since after that call state loss could occur.
visibleDocument | Document that should be made visible. |
---|
true
when visible document has changed.