public class

PSPDFKitPreferences

extends Object
java.lang.Object
   ↳ com.pspdfkit.preferences.PSPDFKitPreferences

Class Overview

Allows you to read and write global preferences.

Summary

Constants
String PREFERENCES_NAME Name of the shared preferences.
Public Methods
void clearPreferences()
Wipes all user preferences, handle with care.
synchronized static PSPDFKitPreferences get(Context context)
Get global singleton preferences instance.
String getAnnotationCreator(String defaultCreator)
Retrieves the annotation creator
List<AnnotationTool> getLastAnnotationTools()
Gets the list of annotation tools as they were last used/selected.
ToolbarCoordinatorLayout.LayoutParams.Position getLastToolbarPosition(ContextualToolbar contextualToolbar, ToolbarCoordinatorLayout.LayoutParams.Position defaultPosition)
Gets the last position of the given toolbar.
boolean isAnnotationCreatorSet()
Checks if the annotation creator has been set
void resetAnnotationCreator()
Resets the annotation creator by nullifying the value.
void setAnnotationCreator(String creator)
Sets the annotation creator.
void setLastAnnotationTool(AnnotationTool tool)
Sets the last used annotation tool.
void setLastToolbarPosition(ContextualToolbar contextualToolbar, ToolbarCoordinatorLayout.LayoutParams.Position position)
Saves the last position of the given toolbar.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String PREFERENCES_NAME

Name of the shared preferences.

Constant Value: "PSPDFKit"

Public Methods

public void clearPreferences ()

Wipes all user preferences, handle with care.

public static synchronized PSPDFKitPreferences get (Context context)

Get global singleton preferences instance.

public String getAnnotationCreator (String defaultCreator)

Retrieves the annotation creator

Parameters
defaultCreator the default creator that will be returned if no creator has been previously stored.
Returns
  • the annotation creator

public List<AnnotationTool> getLastAnnotationTools ()

Gets the list of annotation tools as they were last used/selected. Items that were not yet selected are not in the list, so this means that list will be empty at the beginning so that needs to be handled as well.

public ToolbarCoordinatorLayout.LayoutParams.Position getLastToolbarPosition (ContextualToolbar contextualToolbar, ToolbarCoordinatorLayout.LayoutParams.Position defaultPosition)

Gets the last position of the given toolbar.

Parameters
contextualToolbar Toolbar for which to get the position.
defaultPosition Default toolbar position.
Returns
  • Last position of the toolbar.

public boolean isAnnotationCreatorSet ()

Checks if the annotation creator has been set

Returns
  • return false if the annotation creator has not been set, true otherwise.

public void resetAnnotationCreator ()

Resets the annotation creator by nullifying the value.

public void setAnnotationCreator (String creator)

Sets the annotation creator.

Parameters
creator the creator to set

public void setLastAnnotationTool (AnnotationTool tool)

Sets the last used annotation tool. This method will add the tool to the beginning of the last selected tools list. If it already exists there, it will be just moved to the first place.

Parameters
tool Tool to be set as the last used one.

public void setLastToolbarPosition (ContextualToolbar contextualToolbar, ToolbarCoordinatorLayout.LayoutParams.Position position)

Saves the last position of the given toolbar.

Parameters
contextualToolbar Toolbar for which to save the position.
position Position to be saved.