public class

DocumentActivity

extends AppCompatActivity
implements PdfViewCtrlTabHostFragment.TabHostListener PdfViewCtrlTabHostFragment2.TabHostListener
java.lang.Object
   ↳ AppCompatActivity
     ↳ com.pdftron.pdf.controls.DocumentActivity
Known Direct Subclasses

Class Overview

DocumentActivity is derived from AppCompatActivity and is an all-in-one document reader and PDF editor. UI can be configured via class.

Summary

Nested Classes
class DocumentActivity.IntentBuilder  
Constants
String EXTRA_CONFIG
String EXTRA_CUSTOM_HEADERS
String EXTRA_FILE_EXTENSION
String EXTRA_FILE_PASSWORD
String EXTRA_FILE_RES_ID
String EXTRA_FILE_URI
String EXTRA_FILE_URI_LIST
String EXTRA_NAV_ICON
String EXTRA_NEW_UI
String EXTRA_UI_THEME
Fields
public static final int DEFAULT_NAV_ICON_ID
Public Constructors
DocumentActivity()
Public Methods
boolean canRecreateActivity()
Called when about the re-create Activity for day/night mode
boolean canShowFileCloseSnackbar()
The implementation should determine whether closing a tab should show re-open snackbar.
boolean canShowFileInFolder()
The implementation should determine whether the long press on tab widget should show file info.
void onBackPressed()
void onExitSearchMode()
Called when search view collapsed
void onJumpToSdCardFolder()
Called when an SD card file is opened as a local file
void onLastTabClosed()
Called when the last tab in the tab host has been closed, and therefore there is no more tab.
void onNavButtonPressed()
Called when navigation button has been pressed.
boolean onOpenDocError()
Called when an error has been happened when opening a document.
void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
void onShowFileInFolder(String fileName, String filepath, int itemSource)
The implementation should browse to the specified file in the folder.
void onStartSearchMode()
Called when search view expanded
void onTabChanged(String tag)
Called when a new tab has been selected excluding the initial tab.
void onTabDocumentLoaded(String tag)
Called when document associated with a tab is loaded
void onTabHostHidden()
Called when the tab host has been hidden.
void onTabHostShown()
Called when the tab host has been shown.
void onTabPaused(FileInfo fileInfo, boolean isDocModifiedAfterOpening)
Called when the fragment is paused.
boolean onToolbarCreateOptionsMenu(Menu menu, MenuInflater inflater)
Called when creating Toolbar options menu
boolean onToolbarOptionsItemSelected(MenuItem item)
Called when Toolbar options menu selected
boolean onToolbarPrepareOptionsMenu(Menu menu)
Called when preparing Toolbar options menu
static void openDocument(Context packageContext, Uri fileUri, ViewerConfig config)
Opens a file from Uri with empty password and custom configuration.
static void openDocument(Context packageContext, int resId, ViewerConfig config)
Opens a file from resource id with empty password and custom configuration.
static void openDocument(Context packageContext, Uri fileUri, String password)
Opens a file from Uri with password and default configuration.
static void openDocument(Context packageContext, int resId)
Opens a file from resource id with empty password and default configuration.
static void openDocument(Context packageContext, int resId, String password, ViewerConfig config)
Opens a file from resource id with password and custom configuration.
static void openDocument(Context packageContext, int resId, String password)
Opens a file from resource id with password and default configuration.
static void openDocument(Context packageContext, Uri fileUri)
Opens a file from Uri with empty password and default configuration.
static void openDocument(Context packageContext, Uri fileUri, String password, JSONObject customHeaders, ViewerConfig config, int navIconId, boolean newUi)
Opens a file from Uri with password and custom configuration.
static void openDocument(Context packageContext, Uri fileUri, String password, ViewerConfig config)
Opens a file from Uri with password and custom configuration.
static void openDocument(Context packageContext, Uri fileUri, String password, JSONObject customHeaders, ViewerConfig config, int navIconId)
Opens a file from Uri with password and custom configuration.
static void openDocument(Context packageContext, Uri fileUri, String password, JSONObject customHeaders, ViewerConfig config)
Opens a file from Uri with password and custom configuration.
static void openDocuments(Context packageContext, ArrayList<Uri> fileUris, ViewerConfig config)
Opens a list of files from Uri with custom configuration.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pdftron.pdf.controls.PdfViewCtrlTabHostBaseFragment.TabHostListener

Constants

public static final String EXTRA_CONFIG

Constant Value: "extra_config"

public static final String EXTRA_CUSTOM_HEADERS

Constant Value: "extra_custom_headers"

public static final String EXTRA_FILE_EXTENSION

Constant Value: "extra_file_extension"

public static final String EXTRA_FILE_PASSWORD

Constant Value: "extra_file_password"

public static final String EXTRA_FILE_RES_ID

Constant Value: "extra_file_res_id"

public static final String EXTRA_FILE_URI

Constant Value: "extra_file_uri"

public static final String EXTRA_FILE_URI_LIST

Constant Value: "extra_file_uri_list"

public static final String EXTRA_NAV_ICON

Constant Value: "extra_nav_icon"

public static final String EXTRA_NEW_UI

Constant Value: "extra_new_ui"

public static final String EXTRA_UI_THEME

Constant Value: "extra_ui_theme"

Fields

public static final int DEFAULT_NAV_ICON_ID

Public Constructors

public DocumentActivity ()

Public Methods

public boolean canRecreateActivity ()

Called when about the re-create Activity for day/night mode

public boolean canShowFileCloseSnackbar ()

The implementation should determine whether closing a tab should show re-open snackbar.

Returns
  • true if can show snackbar, false otherwise

public boolean canShowFileInFolder ()

The implementation should determine whether the long press on tab widget should show file info.

Returns
  • true if long press shows file info, false otherwise

public void onBackPressed ()

public void onExitSearchMode ()

Called when search view collapsed

public void onJumpToSdCardFolder ()

Called when an SD card file is opened as a local file

public void onLastTabClosed ()

Called when the last tab in the tab host has been closed, and therefore there is no more tab.

public void onNavButtonPressed ()

Called when navigation button has been pressed.

public boolean onOpenDocError ()

Called when an error has been happened when opening a document.

public void onRequestPermissionsResult (int requestCode, String[] permissions, int[] grantResults)

public void onShowFileInFolder (String fileName, String filepath, int itemSource)

The implementation should browse to the specified file in the folder.

Parameters
fileName The file name
filepath The file path
itemSource The item source of the file

public void onStartSearchMode ()

Called when search view expanded

public void onTabChanged (String tag)

Called when a new tab has been selected excluding the initial tab.

Parameters
tag the tab tag changed to

public void onTabDocumentLoaded (String tag)

Called when document associated with a tab is loaded

Parameters
tag the document tag

public void onTabHostHidden ()

Called when the tab host has been hidden.

public void onTabHostShown ()

Called when the tab host has been shown.

public void onTabPaused (FileInfo fileInfo, boolean isDocModifiedAfterOpening)

Called when the fragment is paused.

Parameters
fileInfo The file shown when tab has been paused
isDocModifiedAfterOpening True if document has been modified after opening; False otherwise

public boolean onToolbarCreateOptionsMenu (Menu menu, MenuInflater inflater)

Called when creating Toolbar options menu

Parameters
menu the menu
inflater the inflater

public boolean onToolbarOptionsItemSelected (MenuItem item)

Called when Toolbar options menu selected

Parameters
item the menu item

public boolean onToolbarPrepareOptionsMenu (Menu menu)

Called when preparing Toolbar options menu

Parameters
menu the menu

public static void openDocument (Context packageContext, Uri fileUri, ViewerConfig config)

Opens a file from Uri with empty password and custom configuration.

Parameters
packageContext the context
fileUri the file Uri
config the configuration

public static void openDocument (Context packageContext, int resId, ViewerConfig config)

Opens a file from resource id with empty password and custom configuration.

Parameters
packageContext the context
resId the resource id
config the configuration

public static void openDocument (Context packageContext, Uri fileUri, String password)

Opens a file from Uri with password and default configuration.

Parameters
packageContext the context
fileUri the file Uri
password the password

public static void openDocument (Context packageContext, int resId)

Opens a file from resource id with empty password and default configuration.

Parameters
packageContext the context
resId the resource id

public static void openDocument (Context packageContext, int resId, String password, ViewerConfig config)

Opens a file from resource id with password and custom configuration.

Parameters
packageContext the context
resId the resource id
password the password
config the configuration

public static void openDocument (Context packageContext, int resId, String password)

Opens a file from resource id with password and default configuration.

Parameters
packageContext the context
resId the resource id
password the password

public static void openDocument (Context packageContext, Uri fileUri)

Opens a file from Uri with empty password and default configuration.

Parameters
packageContext the context
fileUri the file Uri

public static void openDocument (Context packageContext, Uri fileUri, String password, JSONObject customHeaders, ViewerConfig config, int navIconId, boolean newUi)

Opens a file from Uri with password and custom configuration.

Parameters
packageContext the context
fileUri the file Uri
password the password
customHeaders the custom headers for the request (only applies to HTTP/HTTPS URLs)
config the configuration
navIconId the drawable resource id for the navigation button
newUi true if use new UI, legacy UI will be used otherwise

public static void openDocument (Context packageContext, Uri fileUri, String password, ViewerConfig config)

Opens a file from Uri with password and custom configuration.

Parameters
packageContext the context
fileUri the file Uri
password the password
config the configuration

public static void openDocument (Context packageContext, Uri fileUri, String password, JSONObject customHeaders, ViewerConfig config, int navIconId)

Opens a file from Uri with password and custom configuration.

Parameters
packageContext the context
fileUri the file Uri
password the password
customHeaders the custom headers for the request (only applies to HTTP/HTTPS URLs)
config the configuration
navIconId the drawable resource id for the navigation button

public static void openDocument (Context packageContext, Uri fileUri, String password, JSONObject customHeaders, ViewerConfig config)

Opens a file from Uri with password and custom configuration.

Parameters
packageContext the context
fileUri the file Uri
password the password
customHeaders the custom headers for the request (only applies to HTTP/HTTPS URLs)
config the configuration

public static void openDocuments (Context packageContext, ArrayList<Uri> fileUris, ViewerConfig config)

Opens a list of files from Uri with custom configuration.

Parameters
packageContext the context
fileUris the file Uri list