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)
Gets global singleton preferences instance.
String getAnnotationCreator(String defaultCreator)
Retrieves the annotation creator
List<Pair<AnnotationToolAnnotationToolVariant>> 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.
List<Integer> getRecentlyUsedColors()
Gets the recently used colors.
boolean isAnnotationCreatorSet()
Checks if the annotation creator has been set
Boolean isComparisonFirstLaunch()
Returns True if it's the first time launching comparison alignment dialog and false when it has been launched before.
Boolean isMeasurementSnappingEnabled()
Returns true if snapping to page graphics for measurement tools is enabled.
Boolean isSmartGuidesEnabled()
Returns true if smart guides for various angles is enabled.
Boolean isSnapToSelfEnabled()
Returns true if snapping to self is enabled.
void resetAnnotationCreator()
Resets the annotation creator by nullifying the value.
void setAnnotationCreator(String creator)
Sets the annotation creator.
void setIsComparisonFirstLaunch(boolean isComparisonFirstLaunch)
Sets if comparison alignment dialog has been launched before
void setLastAnnotationTool(AnnotationTool tool)
Sets the last used annotation tool.
void setLastAnnotationTool(AnnotationTool tool, AnnotationToolVariant toolVariant)
Sets the last used annotation tool.
void setLastToolbarPosition(ContextualToolbar contextualToolbar, ToolbarCoordinatorLayout.LayoutParams.Position position)
Saves the last position of the given toolbar.
void setMeasurementSnappingEnabled(boolean enabled)
Enables snapping to page graphics for measurement tools.
void setRecentlyUsedColors(List<Integer> recentlyUsedColors)
Replaces the list of recently used colors with the new list.
void setSmartGuidesEnabled(boolean enabled)
Enables smart guides for predefined angles.
void setSnapToSelfEnabled(boolean enabled)
Enables snapping to itself at the end of shape
[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)

Gets 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<Pair<AnnotationToolAnnotationToolVariant>> 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 List<Integer> getRecentlyUsedColors ()

Gets the recently used colors.

Returns
  • The recently used colors, this might be empty.

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 Boolean isComparisonFirstLaunch ()

Returns True if it's the first time launching comparison alignment dialog and false when it has been launched before. .

public Boolean isMeasurementSnappingEnabled ()

Returns true if snapping to page graphics for measurement tools is enabled. Default value is true.

public Boolean isSmartGuidesEnabled ()

Returns true if smart guides for various angles is enabled. Default value is true.

public Boolean isSnapToSelfEnabled ()

Returns true if snapping to self is enabled. Default value is true.

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 setIsComparisonFirstLaunch (boolean isComparisonFirstLaunch)

Sets if comparison alignment dialog has been launched before

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 setLastAnnotationTool (AnnotationTool tool, AnnotationToolVariant toolVariant)

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.
toolVariant Variant of the annotation tool for which to set the value.

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.

public void setMeasurementSnappingEnabled (boolean enabled)

Enables snapping to page graphics for measurement tools.

public void setRecentlyUsedColors (List<Integer> recentlyUsedColors)

Replaces the list of recently used colors with the new list.

Parameters
recentlyUsedColors The new colors to set as recently used colors.

public void setSmartGuidesEnabled (boolean enabled)

Enables smart guides for predefined angles.

public void setSnapToSelfEnabled (boolean enabled)

Enables snapping to itself at the end of shape