public class

AnnotationToolbarComponent

extends Object
implements AdvancedShapeCreate.OnEditToolbarListener
java.lang.Object
   ↳ com.pdftron.pdf.widget.toolbar.component.AnnotationToolbarComponent
Known Direct Subclasses

Class Overview

Annotation Toolbar UI Component that is in charge of handling the toolbar logic and UI events.

Summary

Nested Classes
interface AnnotationToolbarComponent.AnnotationButtonClickListener Annotation button click listeners  
interface AnnotationToolbarComponent.OnPreBuildToolbarListener Listener called prior to building a new AnnotationToolbar. 
interface AnnotationToolbarComponent.OnToolbarChangedListener Listener called when toolbar changes. 
Constants
String TOOLBAR_ITEM_BUNDLE
String TOOLMODE_DISABLED
Public Constructors
AnnotationToolbarComponent(LifecycleOwner lifecycleOwner, AnnotationToolbarViewModel annotationToolbarViewModel, PresetBarViewModel presetBarViewModel, ToolManagerViewModel toolManagerViewModel, ViewGroup container)
Creates a the default AnnotationToolbarComponent
AnnotationToolbarComponent(LifecycleOwner lifecycleOwner, AnnotationToolbarViewModel annotationToolbarViewModel, PresetBarViewModel presetBarViewModel, ToolManagerViewModel toolManagerViewModel, AnnotationToolbarView view)
Public Methods
void addButtonClickListener(AnnotationToolbarComponent.AnnotationButtonClickListener onMenuItemClickListener)
Adds click listener for toolbar button clicks
void addOnPreBuildToolbarListener(AnnotationToolbarComponent.OnPreBuildToolbarListener listener)
Add listener to notify prior to building a new AnnotationToolbar.
void addOnToolbarChangedListener(AnnotationToolbarComponent.OnToolbarChangedListener listener)
Add listener to notify when the toolbar changes.
void addToolbarActionsRightOptionalContainer(View view)
Adds a view to the right of the non-sticky tools in the annotation toolbar in the non-sticky button area.
void addToolbarLeftOptionalContainer(View view)
Adds a view to the left of the non-sticky tools in the annotation toolbar in the non-sticky button area.
void addToolbarOverlay(View view)
Adds a view on top of the annotation toolbar in the non-sticky button area.
AppCompatButton buildRedactionApplyButton()
void clearOptionalToolbarContainer()
Removes all child views from the optional contains which incldues the left container and overlay views.
void clearState()
Clears annotation toolbar state and deselects any selected tools.
void clearToolbarOverlayView()
Removes the annotation toolbar's overlay view.
void closeEditToolbar()
Closes the edit toolbar
void hide(boolean animated)
void inflateWithBuilder(AnnotationToolbarBuilder builder)
Clears current state and inflates the annotation toolbar view with the given AnnotationToolbarBuilder.
boolean isEditing()
void rememberLastUsedTool(boolean lastUsedTool)
Whether toolbars should re-select the last used tool when leave and returning back to the toolbar.
void removeButtonClickListener(AnnotationToolbarComponent.AnnotationButtonClickListener onMenuItemClickListener)
Removes click listener for toolbar button clicks
void removeOnPreBuildToolbarListener(AnnotationToolbarComponent.OnPreBuildToolbarListener listener)
Remove listener that notifies prior to building a new AnnotationToolbar.
void removeOnToolbarChangedListener(AnnotationToolbarComponent.OnToolbarChangedListener listener)
Remove listener that notifies when the toolbar changes.
void selectToolbarButton(int buttonId)
Selects the toolbar button if available.
void setCompactMode(boolean compactMode)
In compact mode, the annotation toolbar will prepend toolbar switcher in front of scrollable tools.
void setEmptyToolText(int emptyText)
Sets the string resource for empty text view
void setEmptyToolTextOnClickListener(View.OnClickListener listener)
Sets the event when click on the empty tool text view in the non-sticky button area.
void setEmptyToolTextVisible(boolean visible)
Sets the visibility of the empty tool text view in the non-sticky button area.
void setItemEnabled(int buttonId, boolean isEnabled)
Sets whether a button is enabled in the toolbar.
void setItemVisibility(int buttonId, boolean isVisible)
void setNavigationIcon(int icon)
Used only in compact mode, sets the navigation icon for edit toolbar.
void setNavigationIconProperty(int paddingLeft, int minWidth)
void setNavigationIconVisible(boolean visible)
Used only in compact mode, sets the visibility of navigation icon for edit toolbar.
void setToolModeFilter(Set<ToolManager.ToolMode> disabledToolModes)
Defines tool modes that are used to filter out related tool buttons in the toolbar.
void setToolRegionVisible(boolean visible)
Sets the visibility of the tool region in the non-sticky button area.
void setToolbarButtonVisibility(ToolbarButtonType buttonType, boolean visibility)
Sets whether toolbar tool buttons should be visible in all toolbars
void setToolbarHeight(int height)
void setToolbarItemGravity(int layoutGravity)
Sets the layout gravity of toolbar items.
void show(boolean animated)
void showEditToolbar(ToolManager.ToolMode toolMode, Annot annot, int pageNum)
Show edit toolbar either for an existing annotation on a given page, or a brand new annotation (i.e.
void showEditToolbar(ToolManager.ToolMode toolMode, Annot annot, int pageNum, boolean keepAnnotatingAfterDismiss)
Show edit toolbar either for an existing annotation on a given page, or a brand new annotation (i.e.
void showUndoRedoPopup(View anchor)
void slideIn()
void slideOut()
void updateToolbarState()
Force annotation toolbar to update state.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pdftron.pdf.tools.AdvancedShapeCreate.OnEditToolbarListener

Constants

public static final String TOOLBAR_ITEM_BUNDLE

Constant Value: "toolbarItem"

public static final String TOOLMODE_DISABLED

Constant Value: "toolmode_disabled"

Public Constructors

public AnnotationToolbarComponent (LifecycleOwner lifecycleOwner, AnnotationToolbarViewModel annotationToolbarViewModel, PresetBarViewModel presetBarViewModel, ToolManagerViewModel toolManagerViewModel, ViewGroup container)

Creates a the default AnnotationToolbarComponent

Parameters
lifecycleOwner the lifecycle owner that will handle this UI component's state
presetBarViewModel the PresetBarViewModel that manages the preset bar state
toolManagerViewModel the ToolManagerViewModel that manages the current ToolManager
container the container to add this AnnotationToolbarComponent

public AnnotationToolbarComponent (LifecycleOwner lifecycleOwner, AnnotationToolbarViewModel annotationToolbarViewModel, PresetBarViewModel presetBarViewModel, ToolManagerViewModel toolManagerViewModel, AnnotationToolbarView view)

Public Methods

public void addButtonClickListener (AnnotationToolbarComponent.AnnotationButtonClickListener onMenuItemClickListener)

Adds click listener for toolbar button clicks

Parameters
onMenuItemClickListener the listener

public void addOnPreBuildToolbarListener (AnnotationToolbarComponent.OnPreBuildToolbarListener listener)

Add listener to notify prior to building a new AnnotationToolbar.

Parameters
listener to add

public void addOnToolbarChangedListener (AnnotationToolbarComponent.OnToolbarChangedListener listener)

Add listener to notify when the toolbar changes.

Parameters
listener to add

public void addToolbarActionsRightOptionalContainer (View view)

Adds a view to the right of the non-sticky tools in the annotation toolbar in the non-sticky button area. This is used for custom annotation toolbars that require additional UI components that are not tool buttons

Parameters
view the view to add to the container to the right of non-sticky tools

public void addToolbarLeftOptionalContainer (View view)

Adds a view to the left of the non-sticky tools in the annotation toolbar in the non-sticky button area. This is used for custom annotation toolbars that require additional UI components that are not tool buttons

Parameters
view the view to add to the container to the left of non-sticky tools

public void addToolbarOverlay (View view)

Adds a view on top of the annotation toolbar in the non-sticky button area. This is used for custom annotation toolbars that do not make use of tool buttons.

Parameters
view the view to overlay on top of the annotation toolbar

public AppCompatButton buildRedactionApplyButton ()

public void clearOptionalToolbarContainer ()

Removes all child views from the optional contains which incldues the left container and overlay views.

public void clearState ()

Clears annotation toolbar state and deselects any selected tools. By default, when no tools are selected then the pan tool will be used.

public void clearToolbarOverlayView ()

Removes the annotation toolbar's overlay view.

public void closeEditToolbar ()

Closes the edit toolbar

public void hide (boolean animated)

public void inflateWithBuilder (AnnotationToolbarBuilder builder)

Clears current state and inflates the annotation toolbar view with the given AnnotationToolbarBuilder.

Parameters
builder the builder that defines a new annotation toolbar state

public boolean isEditing ()

public void rememberLastUsedTool (boolean lastUsedTool)

Whether toolbars should re-select the last used tool when leave and returning back to the toolbar.

Parameters
lastUsedTool true if last used tool should be selected upon returning to the toolbar

public void removeButtonClickListener (AnnotationToolbarComponent.AnnotationButtonClickListener onMenuItemClickListener)

Removes click listener for toolbar button clicks

Parameters
onMenuItemClickListener the listener

public void removeOnPreBuildToolbarListener (AnnotationToolbarComponent.OnPreBuildToolbarListener listener)

Remove listener that notifies prior to building a new AnnotationToolbar.

Parameters
listener to remove

public void removeOnToolbarChangedListener (AnnotationToolbarComponent.OnToolbarChangedListener listener)

Remove listener that notifies when the toolbar changes.

Parameters
listener to remove

public void selectToolbarButton (int buttonId)

Selects the toolbar button if available. Button must be of selectable type, see addCustomSelectableButton(int, int, int).

Parameters
buttonId the unique id of the toolbar button

public void setCompactMode (boolean compactMode)

In compact mode, the annotation toolbar will prepend toolbar switcher in front of scrollable tools. In non-compact mode, it is assumed that toolbar switcher is located somewhere else in the viewer

Parameters
compactMode true if in compact mode, false otherwise. Default to false.

public void setEmptyToolText (int emptyText)

Sets the string resource for empty text view

Parameters
emptyText the string resource

public void setEmptyToolTextOnClickListener (View.OnClickListener listener)

Sets the event when click on the empty tool text view in the non-sticky button area.

Parameters
listener the event

public void setEmptyToolTextVisible (boolean visible)

Sets the visibility of the empty tool text view in the non-sticky button area. This is used for special cases where no tools are in the toolbar.

Parameters
visible true if empty text view is visible, false otherwise

public void setItemEnabled (int buttonId, boolean isEnabled)

Sets whether a button is enabled in the toolbar. If the button is enabled, then it will be clickable otherwise touch events are ignored.

Parameters
buttonId unique id of the button
isEnabled whether the button should be enabled

public void setItemVisibility (int buttonId, boolean isVisible)

public void setNavigationIcon (int icon)

Used only in compact mode, sets the navigation icon for edit toolbar.

Parameters
icon the icon resource.

public void setNavigationIconProperty (int paddingLeft, int minWidth)

public void setNavigationIconVisible (boolean visible)

Used only in compact mode, sets the visibility of navigation icon for edit toolbar.

Parameters
visible true if visible, false otherwise.

public void setToolModeFilter (Set<ToolManager.ToolMode> disabledToolModes)

Defines tool modes that are used to filter out related tool buttons in the toolbar.

See ToolModeMapper for a map between tool mode and toolbar buttons

Parameters
disabledToolModes tool modes used to filter out related toolbar buttons

public void setToolRegionVisible (boolean visible)

Sets the visibility of the tool region in the non-sticky button area. This is used for special cases where tools are not ready to be shown yet. Note, toolbar switcher will be shown in compact mode.

Parameters
visible true if the tool region is visible, false otherwise

public void setToolbarButtonVisibility (ToolbarButtonType buttonType, boolean visibility)

Sets whether toolbar tool buttons should be visible in all toolbars

Parameters
buttonType that defines related tool buttons
visibility the visibility of these buttons in all toolbars

public void setToolbarHeight (int height)

public void setToolbarItemGravity (int layoutGravity)

Sets the layout gravity of toolbar items.

Parameters
layoutGravity gravity to set the toolbar items

public void show (boolean animated)

public void showEditToolbar (ToolManager.ToolMode toolMode, Annot annot, int pageNum)

Show edit toolbar either for an existing annotation on a given page, or a brand new annotation (i.e. when annot == null). After the edit toolbar is dismissed the tool will still be selected and you can keep annotating.

Parameters
toolMode The tool mode that should be selected when open edit toolbar
annot The selected annotation
pageNum The page of the selected anntoation

public void showEditToolbar (ToolManager.ToolMode toolMode, Annot annot, int pageNum, boolean keepAnnotatingAfterDismiss)

Show edit toolbar either for an existing annotation on a given page, or a brand new annotation (i.e. when annot == null). If keepAnnotatingAfterDismiss is true, then keep annotating after the edit toolbar is dismissed, otherwise switch to pan tool when edit toolbar is dismissed.

Parameters
toolMode The tool mode that should be selected when open edit toolbar
annot The selected annotation
pageNum The page of the selected anntoation
keepAnnotatingAfterDismiss whether we should keep annotating after the edit toolbar is dismissed

public void showUndoRedoPopup (View anchor)

public void slideIn ()

public void slideOut ()

public void updateToolbarState ()

Force annotation toolbar to update state.