java.lang.Object | |
↳ | com.pspdfkit.ui.DocumentDescriptor |
Describes a document and its UI state. The DocumentDescriptor
is used by the PdfActivity
's DocumentCoordinator
to handle multiple loaded documents and to manage
their state.
Document is represented by the list of parcelable DocumentSource
s. Descriptor also
holds loaded PdfDocument
after it's loaded by the DocumentCoordinator
. Note that
this PdfDocument
instance won't be restored after reading from the parcel - it must be
loaded again in this case.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final Creator<DocumentDescriptor> | CREATOR |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DocumentDescriptor(Parcel in) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | describeContents() | ||||||||||
static DocumentDescriptor |
fromDataProvider(DataProvider dataProvider, String password, String contentSignature)
Creates descriptor for document loaded from data provider.
| ||||||||||
static DocumentDescriptor |
fromDataProvider(DataProvider dataProvider)
Creates descriptor for document loaded from data provider.
| ||||||||||
static DocumentDescriptor |
fromDataProvider(DataProvider dataProvider, String password)
Creates descriptor for document loaded from data provider.
| ||||||||||
static DocumentDescriptor |
fromDataProviders(List<DataProvider> dataProviders, List<String> passwords, List<String> contentSignatures)
Creates descriptor for compound document loaded from data providers.
| ||||||||||
static DocumentDescriptor |
fromDocument(PdfDocument document)
Creates descriptor for loaded document.
| ||||||||||
static DocumentDescriptor |
fromDocumentSource(DocumentSource documentSource)
Creates descriptor for document loaded from document source.
| ||||||||||
static DocumentDescriptor |
fromDocumentSources(List<DocumentSource> documentSources)
Creates descriptor for compound document loaded from document sources.
| ||||||||||
static DocumentDescriptor |
fromUri(Uri documentUri, String password)
Creates descriptor for document loaded from URI.
| ||||||||||
static DocumentDescriptor |
fromUri(Uri documentUri)
Creates descriptor for document loaded from URI.
| ||||||||||
static DocumentDescriptor |
fromUris(List<Uri> documentUris, List<String> passwords, List<String> contentSignatures)
Creates descriptor for compound document loaded from multiple URIs.
| ||||||||||
String |
getCustomTitle()
Returns custom document title that has been previously set via
setTitle(String) . | ||||||||||
PdfDocument |
getDocument()
Returns document instance (if already loaded).
| ||||||||||
DocumentSource |
getDocumentSource()
Returns source from which the document should be loaded.
| ||||||||||
List<DocumentSource> |
getDocumentSources()
Returns list of
DocumentSource s from which the document should be loaded. | ||||||||||
Bundle |
getState()
Returns UI state associated with the document.
| ||||||||||
String |
getTitle(Context context)
Returns displayable document title.
| ||||||||||
String |
getUid()
Returns unique document ID.
| ||||||||||
static DocumentDescriptor |
imageDocumentFromDataProvider(DataProvider dataProvider)
Creates descriptor for image document loaded from data provider.
| ||||||||||
static DocumentDescriptor |
imageDocumentFromDocumentSource(DocumentSource documentSource)
Creates descriptor for image document loaded from a document source.
| ||||||||||
static DocumentDescriptor |
imageDocumentFromUri(Uri uri)
Creates descriptor for image document loaded from URI.
| ||||||||||
boolean |
isImageDocument()
Checks whether descriptor describes an image document.
| ||||||||||
void |
setDocument(PdfDocument document)
Sets document instance associated with this descriptor.
| ||||||||||
void |
setState(Bundle state)
Sets UI state (activity or fragment) associated with the document.
| ||||||||||
void |
setTitle(String title)
Sets a custom displayable document title.
| ||||||||||
void | writeToParcel(Parcel dest, int flags) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates descriptor for document loaded from data provider.
dataProvider | Data provider for the document. |
---|---|
password | Document password. May be null . |
contentSignature | Document content signature. May be null .
|
Creates descriptor for document loaded from data provider.
dataProvider | Data provider for the document. |
---|
Creates descriptor for document loaded from data provider.
dataProvider | Data provider for the document. |
---|---|
password | Document password. May be null .
|
Creates descriptor for compound document loaded from data providers.
dataProviders | List of data providers for compound document. |
---|---|
passwords | List of passwords for compound document, may be null . |
contentSignatures | List of content signatures for compound document, may be null .
|
Creates descriptor for loaded document.
document | Document instance. |
---|
Creates descriptor for document loaded from document source.
documentSource | Source of the document data. |
---|
Creates descriptor for compound document loaded from document sources.
documentSources | List of sources for compound document. |
---|
Creates descriptor for document loaded from URI.
documentUri | Uri of the PDF file. |
---|---|
password | Passwords of the document to open, may be null .
|
Creates descriptor for document loaded from URI.
documentUri | Uri of the PDF file. |
---|
Creates descriptor for compound document loaded from multiple URIs.
documentUris | List of document URIs for compound document. |
---|---|
passwords | List of passwords for compound document, may be null . |
contentSignatures | List of content signatures for compound document, may be null .
|
Returns custom document title that has been previously set via setTitle(String)
.
Returns document instance (if already loaded).
null
otherwise.
Returns source from which the document should be loaded. A source can be either a file URI or
a DataProvider
.
DocumentSource
for this document. If the document is a compound one (i.e.
it contains multiple files) this method returns the first entry of the array returned by
getDocumentSources()
.
Returns list of DocumentSource
s from which the document should be loaded. A source
can be either a file URI or a DataProvider
. Only compound documents will have
multiple sources.
DocumentSource
s for this document. If the document is a compound
one (i.e. is read from multiple sources) it will have several sources, otherwise it the
list will contain a single entry.
Returns UI state associated with the document.
null
if not available.
Returns displayable document title.
context | The context used to retrieve localized title. |
---|
Creates descriptor for image document loaded from data provider.
dataProvider | Data provider for the image document. |
---|
Creates descriptor for image document loaded from a document source.
documentSource | Source of the image document data. |
---|
Creates descriptor for image document loaded from URI.
uri | URI for the image document. |
---|
Checks whether descriptor describes an image document.
true
if this is a descriptor for an image document.
Sets document instance associated with this descriptor.
document | Document instance, or null to clear existing document instance.
|
---|
Sets UI state (activity or fragment) associated with the document.
state | Bundle with UI state. |
---|
Sets a custom displayable document title. When null
the default document title will
be used.
Note: This method does not modify the PDF document, to persistently set the title
in the PDF metadata see setTitle(String)
.
title | Custom document title to display. |
---|