Class PdfActivityIntentBuilder
-
- All Implemented Interfaces:
public final class PdfActivityIntentBuilder extends BasePdfUiBuilder<T>
Builder used for creating an intent for starting PdfActivity. Allows setting the document and all of the necessary configuration such as document sources, passwords, etc.
-
-
Method Summary
Modifier and Type Method Description static PdfActivityIntentBuilder
fromUri(@NonNull() Context context, @NonNull() Array<Uri> uris)
Creates a new intent builder with document being loaded from URI. static PdfActivityIntentBuilder
fromDataProvider(@NonNull() Context context, @NonNull() Array<DataProvider> dataProviders)
Creates a new intent builder with document being loaded from data provider. static PdfActivityIntentBuilder
fromImageUri(@NonNull() Context context, @NonNull() Uri uri)
Creates a new intent builder with image document being loaded from Uri. static PdfActivityIntentBuilder
fromImageProvider(@NonNull() Context context, @NonNull() DataProvider dataProvider)
Creates a new intent builder with an image document being loaded from data provider. static PdfActivityIntentBuilder
fromDocumentDescriptor(@NonNull() Context context, @NonNull() Array<DocumentDescriptor> documentDescriptor)
Creates a new intent builder with document describe by DocumentDescriptor. static PdfActivityIntentBuilder
emptyActivity(@NonNull() Context context)
Creates a new intent builder with no document, this is useful if you provide custom UI inside your PdfActivity subclass to open new documents. PdfActivityIntentBuilder
configuration(@Nullable() PdfActivityConfiguration configuration)
Sets PdfActivityConfiguration to be set on the target PdfActivity in which the document(s) will be displayed. PdfActivityIntentBuilder
activityClass(@Nullable() Class<out PdfActivity> activityClass)
Sets a custom activity
class used for document display.PdfActivityIntentBuilder
activityClass(@Nullable() KClass<out PdfActivity> activityClass)
Sets a custom activity
class used for document display.PdfActivityIntentBuilder
passwords(@Nullable() Array<String> passwords)
Sets list of passwords for when the opened document is merged from several documents or for a single document. PdfActivityIntentBuilder
contentSignatures(@Nullable() Array<String> contentSignatures)
Sets list of content signatures for when the opened document is merged from several documents or for a single document. PdfActivityIntentBuilder
visibleDocument(int visibleDocumentIndex)
Sets index of the document that should be visible after opening the activity. Intent
build()
Builds Intent with the values provided in the PdfActivityIntentBuilder. -
-
Method Detail
-
fromUri
static PdfActivityIntentBuilder fromUri(@NonNull() Context context, @NonNull() Array<Uri> uris)
Creates a new intent builder with document being loaded from URI. If there are multiple passed URIs, multiple documents will be loaded and merged into a single document.
- Parameters:
context
- Context of the calling component, used for intent creation.uris
- List of URIs of the documents to merge and open, or just a single URI for a single document to be opened.- Returns:
Intent builder with specified document URIs as the source.
-
fromDataProvider
static PdfActivityIntentBuilder fromDataProvider(@NonNull() Context context, @NonNull() Array<DataProvider> dataProviders)
Creates a new intent builder with document being loaded from data provider. If there are multiple passed data providers, multiple documents will be loaded and merged into a single document.
- Parameters:
context
- Context of the calling component, used for intent creation.dataProviders
- List of data providers of the documents to merge and open, or just a single data provider for a single document to be opened.- Returns:
Intent builder with specified document data providers as the source.
-
fromImageUri
static PdfActivityIntentBuilder fromImageUri(@NonNull() Context context, @NonNull() Uri uri)
Creates a new intent builder with image document being loaded from Uri.
- Parameters:
context
- Context of the calling component, used for intent creation.uri
- Uri of the image document to open.- Returns:
Intent builder with specified document Uri as the source.
-
fromImageProvider
static PdfActivityIntentBuilder fromImageProvider(@NonNull() Context context, @NonNull() DataProvider dataProvider)
Creates a new intent builder with an image document being loaded from data provider.
- Parameters:
context
- Context of the calling component, used for intent creation.dataProvider
- Data provider of the image documents to open.- Returns:
Intent builder with specified image document data provider as the source.
-
fromDocumentDescriptor
@NonNull() static PdfActivityIntentBuilder fromDocumentDescriptor(@NonNull() Context context, @NonNull() Array<DocumentDescriptor> documentDescriptor)
Creates a new intent builder with document describe by DocumentDescriptor. If there are multiple passed document descriptors, documents for these descriptors will be displayed as tabs.
- Parameters:
context
- Context of the calling component, used for intent creation.documentDescriptor
- List of document descriptors for documents that should be displayed in the PdfActivity.- Returns:
Intent builder instance.
-
emptyActivity
@NonNull() static PdfActivityIntentBuilder emptyActivity(@NonNull() Context context)
Creates a new intent builder with no document, this is useful if you provide custom UI inside your PdfActivity subclass to open new documents.
- Parameters:
context
- Context of the calling component, used for intent creation.- Returns:
Intent builder instance.
-
configuration
@NonNull() PdfActivityIntentBuilder configuration(@Nullable() PdfActivityConfiguration configuration)
Sets PdfActivityConfiguration to be set on the target PdfActivity in which the document(s) will be displayed. If
null
the default configuration will be set.- Parameters:
configuration
- Activity configuration to be set on the target activity.- Returns:
Builder for PdfActivityIntentBuilder with set activity configuration.
-
activityClass
@NonNull() PdfActivityIntentBuilder activityClass(@Nullable() Class<out PdfActivity> activityClass)
Sets a custom
activity
class used for document display. Theactivity
must extend PdfActivity and must be registered in theAndroidManifest.xml
. Ifnull
is passed, the default PdfActivity will be used for document display.- Parameters:
activityClass
- Custom PdfActivity subclass, ornull
for the default activity to be used.- Returns:
Builder for PdfActivityIntentBuilder with set activity subclass.
-
activityClass
@NonNull() PdfActivityIntentBuilder activityClass(@Nullable() KClass<out PdfActivity> activityClass)
Sets a custom
activity
class used for document display. Theactivity
must extend PdfActivity and must be registered in theAndroidManifest.xml
. Ifnull
is passed, the default PdfActivity will be used for document display.- Parameters:
activityClass
- Custom PdfActivity subclass, ornull
for the default activity to be used.- Returns:
Builder for PdfActivityIntentBuilder with set activity subclass.
-
passwords
@NonNull() PdfActivityIntentBuilder passwords(@Nullable() Array<String> passwords)
Sets list of passwords for when the opened document is merged from several documents or for a single document. The positions of password strings in the list must correspond to positions of URIs or data providers passed in fromUri} or fromDataProvider.
- Parameters:
passwords
- List of document passwords, has to be the same size as the list of URIs or data providers.- Returns:
Builder for PdfActivityIntentBuilder with declared document password(s).
-
contentSignatures
@NonNull() PdfActivityIntentBuilder contentSignatures(@Nullable() Array<String> contentSignatures)
Sets list of content signatures for when the opened document is merged from several documents or for a single document. The positions of content signature strings in the list must correspond to positions of URIs or data providers passed in fromUri} or fromDataProvider.
- Parameters:
contentSignatures
- List of document content signatures, has to be the same size as the list of URIs or data providers.- Returns:
Builder for PdfActivityIntentBuilder with declared document content signature(s).
-
visibleDocument
@NonNull() PdfActivityIntentBuilder visibleDocument(int visibleDocumentIndex)
Sets index of the document that should be visible after opening the activity. This is only valid when builder has been created with multiple documents via fromDocumentDescriptor.
- Parameters:
visibleDocumentIndex
- Index of the visible document.- Returns:
Instance of this builder.
-
-
-
-