public class

PSPDFKitViews

extends Object
java.lang.Object
   ↳ com.pspdfkit.ui.PSPDFKitViews

Class Overview

Class for convenient access of views in a PSPDFKit activity. This class is deliberately not marked final so that it can be mocked in tests.

Summary

Nested Classes
interface PSPDFKitViews.PSPDFView Shared interface of all auxiliary views (search view, thumbnail bar, grid, etc.) that are hosted inside the PdfActivity
enum PSPDFKitViews.Type Known auxiliary view types. 
Public Constructors
PSPDFKitViews(View rootView, PdfActivityConfiguration configuration)
Public Methods
void addOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Add on visibility changed listener to every instantiated view.
PSPDFKitViews.Type getActiveViewType()
Returns currently displayed view over the document.
TextView getDocumentTitleOverlayView()
Returns the currently instantiated document title view.
View getEmptyView()
Returns currently instantiated view that is shown when no document is loaded.
FormEditingBar getFormEditingBarView()
Returns currently instantiated FormEditingBar.
PdfFragment getFragment()
Returns currently instantiated fragment.
View getNavigateBackButton()
Returns the currently instantiate navigate back button.
View getNavigateForwardButton()
Returns the currently instantiate navigate forward button.
PdfOutlineView getOutlineView()
Returns currently instantiated PdfOutlineView.
TextView getPageNumberOverlayView()
Returns currently instantiated page number view.
RedactionView getRedactionView()
Returns currently instantiated RedactionView.
PdfSearchView getSearchView()
Returns currently instantiated PdfSearchView.
PdfTabBar getTabBar()
Returns the currently instantiated tab bar view.
PdfThumbnailBar getThumbnailBarView()
Returns currently instantiated PdfThumbnailBar.
PdfThumbnailGrid getThumbnailGridView()
Returns currently instantiated PdfThumbnailGrid.
PSPDFKitViews.PSPDFView getViewByType(PSPDFKitViews.Type type)
Returns view by the specified type.
void onRestoreViewHierarchyState(Bundle state)
Called after activity recreation, to restore state of views that otherwise wouldn't be restored.
void onSaveViewHierarchyState(Bundle outState)
Called while persisting the activity to persist state of views that otherwise wouldn't be stored.
void removeOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Remove on visibility changed listener from every instantiated view.
void resetDocument()
Reset/clear the document on all instantiated views.
void setDocument(PdfDocument document)
Sets the document to all instantiated views.
boolean showView(PSPDFKitViews.Type viewType)
Similar to toggleView(Type) but not hiding the view if it is already visible.
boolean toggleView(PSPDFKitViews.Type typeToToggle, long showDelay)
Toggles the view with the specified type.
boolean toggleView(PSPDFKitViews.Type typeToToggle)
Toggles the view with the specified type.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PSPDFKitViews (View rootView, PdfActivityConfiguration configuration)

Public Methods

public void addOnVisibilityChangedListener (OnVisibilityChangedListener listener)

Add on visibility changed listener to every instantiated view. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Parameters
listener OnVisibilityChangedListener that should be notified. Must be non-null.

public PSPDFKitViews.Type getActiveViewType ()

Returns currently displayed view over the document.

Returns
  • Currently displayed view, or VIEW_NONE if none active.

public TextView getDocumentTitleOverlayView ()

Returns the currently instantiated document title view.

Returns
  • Currently instantiated document title view or null if document title overlay is deactivated by the current configuration.

public View getEmptyView ()

Returns currently instantiated view that is shown when no document is loaded.

Returns
  • The view that is shown when no document is loaded, or null if no view is set.

public FormEditingBar getFormEditingBarView ()

Returns currently instantiated FormEditingBar.

Returns
  • Currently instantiated form editing bar or null if form editing bar is deactivated by the current configuration.

public PdfFragment getFragment ()

Returns currently instantiated fragment.

Returns
  • Currently active PdfFragment, or null if no document is displayed.

public View getNavigateBackButton ()

Returns the currently instantiate navigate back button.

Returns
  • Currently instantiated navigate back button or null if navigation buttons are deactivated by the current configuration.

public View getNavigateForwardButton ()

Returns the currently instantiate navigate forward button.

Returns
  • Currently instantiated navigate forward button or null if navigation buttons are deactivated by the current configuration.

public PdfOutlineView getOutlineView ()

Returns currently instantiated PdfOutlineView.

Returns
  • Currently instantiated outline view or null if outline is deactivated by the current configuration.

public TextView getPageNumberOverlayView ()

Returns currently instantiated page number view.

Returns
  • Currently instantiated page number view or null if page number overlay is deactivated by the current configuration.

public RedactionView getRedactionView ()

Returns currently instantiated RedactionView.

Returns
  • Currently instantiated redaction view or null if redaction UI is deactivated by current configuration.

public PdfSearchView getSearchView ()

Returns currently instantiated PdfSearchView.

Returns
  • Current active search view or null if search is deactivated by the current configuration.

public PdfTabBar getTabBar ()

Returns the currently instantiated tab bar view.

Returns
  • Currently instantiated tab bar view or null if tab bar is deactivated in the current configuration.

public PdfThumbnailBar getThumbnailBarView ()

Returns currently instantiated PdfThumbnailBar.

Returns
  • Currently instantiated thumbnail bar or null if thumbnail bar is deactivated by the current configuration.

public PdfThumbnailGrid getThumbnailGridView ()

Returns currently instantiated PdfThumbnailGrid.

Returns
  • Currently instantiated thumbnail grid or null if thumbnail grid is deactivated by the current configuration.

public PSPDFKitViews.PSPDFView getViewByType (PSPDFKitViews.Type type)

Returns view by the specified type.

Parameters
type Type of the view to be returned

public void onRestoreViewHierarchyState (Bundle state)

Called after activity recreation, to restore state of views that otherwise wouldn't be restored.

Parameters
state State that was restored.

public void onSaveViewHierarchyState (Bundle outState)

Called while persisting the activity to persist state of views that otherwise wouldn't be stored.

Parameters
outState Outgoing bundle on which to save the state.

public void removeOnVisibilityChangedListener (OnVisibilityChangedListener listener)

Remove on visibility changed listener from every instantiated view. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed,and will result in an exception.

Parameters
listener OnVisibilityChangedListener that should be removed from all views. Must be non-null.

public void resetDocument ()

Reset/clear the document on all instantiated views.

public void setDocument (PdfDocument document)

Sets the document to all instantiated views. This has to be called on the main thread.

Parameters
document Document to be set.

public boolean showView (PSPDFKitViews.Type viewType)

Similar to toggleView(Type) but not hiding the view if it is already visible.

Parameters
viewType PSPDFKitViews.Type of the view to show.
Returns
  • true if the view was shown, or false if the view hierarchy was not changed.

public boolean toggleView (PSPDFKitViews.Type typeToToggle, long showDelay)

Toggles the view with the specified type. If VIEW_NONE just hide the active one.

Parameters
typeToToggle Type of the view to be toggled
showDelay Delay time until toggle.
Returns
  • true if toggle happened, false otherwise

public boolean toggleView (PSPDFKitViews.Type typeToToggle)

Toggles the view with the specified type. If VIEW_NONE just hide the active one.

Parameters
typeToToggle Type of the view to be toggled.
Returns
  • true if toggle happened, false otherwise