java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ com.pdftron.pdf.controls.InsectHandlerToolbar
           ↳ com.pdftron.pdf.controls.BaseToolbar
             ↳ com.pdftron.pdf.controls.AnnotationToolbar

Class Overview

The AnnotationToolbar works with a ToolManager to allow quick selection of different tools. The toolbar shows a list of buttons which prompts the associated ToolManager to switch to that tool. If undo/redo is enabled in the PDFViewCtrl the undo/redo buttons are also provided.

Summary

Nested Classes
interface AnnotationToolbar.AnnotationToolbarListener Callback interface to be invoked when an interaction is needed. 
Constants
String PREF_KEY_LINE
String PREF_KEY_NOTE
String PREF_KEY_RECT
String PREF_KEY_TEXT
int START_MODE_EDIT_TOOLBAR Starts with edit toolbar
int START_MODE_FILL_AND_SIGN_TOOLBAR
int START_MODE_FORM_TOOLBAR
int START_MODE_NORMAL_TOOLBAR Starts with regular annotation toolbar
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
AnnotationToolbar(Context context)
Class constructor
AnnotationToolbar(Context context, AttributeSet attrs)
Class constructor
AnnotationToolbar(Context context, AttributeSet attrs, int defStyleAttr)
Class constructor
AnnotationToolbar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Class constructor
Public Methods
boolean canExpand()
Whether this annotation toolbar has enough tool to fill another row.
void close()
Closes the annotation toolbar.
void closeEditToolbar()
The overloaded implementation of closeEditToolbar().
void closePopups()
Closes the popup windows.
int getButtonIdFromAnnotType(int annotType)
ArrayList<GroupedItem> getGroupItems()
Gets the annotation type grouping and modify accordingly 1.
ToolManager getToolManager()
Gets the ToolManager associated with this toolbar
HashMap<String, Integer> getVisibleAnnotTypeMap()
Gets the visible annotation type when using grouping
boolean handleKeyUp(int keyCode, KeyEvent event)
Handles the shortcuts key in the annotation toolbar.
boolean hasAllTool()
void hideButton(AnnotationToolbarButtonId id)
Hides the toolbar button given a toolbar button id.
boolean isExpanded()
Whether this annotation toolbar is in expanded mode
boolean isInEditMode()
boolean isInFormMode()
boolean isShowing()
void onConfigurationChanged(Configuration newConfig)
The overloaded implementation of View#onConfigurationChanged(Configuration).
void onEditToolbarDismissed()
The overloaded implementation of onEditToolbarDismissed().
void onFormToolbarWillClose()
Called when the form toolbar has been closed.
void selectTool(View view, int id)
Select a tool.
void setAnnotationToolbarListener(AnnotationToolbar.AnnotationToolbarListener listener)
void setButtonStayDown(boolean value)
Specifies whether the button should stay down or return to pan tool after an annotation is created.
void setOnUndoRedoListener(UndoRedoPopupWindow.OnUndoRedoListener listener)
void setup(ToolManager toolManager)
Setups the annotation toolbar window.
void setup(ToolManager toolManager, UndoRedoPopupWindow.OnUndoRedoListener listener)
Setups the annotation toolbar window.
void show(int mode, Annot inkAnnot, int pageNum, ToolManager.ToolMode toolMode, boolean dismissAfterExitEdit)
Shows the annotation toolbar.
void show()
Shows the annotation toolbar.
void show(int mode)
Shows the annotation toolbar.
void showButton(AnnotationToolbarButtonId id)
Shows the toolbar button given a toolbar button id.
void showEditToolbar(ToolManager.ToolMode toolMode, Annot inkAnnot, int pageNum)
The overloaded implementation of showEditToolbar(ToolMode, Annot, int).
void showEditToolbar(ToolManager.ToolMode toolMode)
void showFormToolbar(ToolManager.ToolMode toolMode, int mode)
void toggleExpanded()
Toggles the expanded mode in annotation toolbar
void toolChanged(ToolManager.Tool newTool, ToolManager.Tool oldTool)
The overloaded implementation of toolChanged(ToolManager.Tool, ToolManager.Tool).
void updateButtonsVisibility()
Updates the visibility of the buttons on the annotation toolbar.
[Expand]
Inherited Methods
From class com.pdftron.pdf.controls.BaseToolbar
From class com.pdftron.pdf.controls.InsectHandlerToolbar
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource
From interface com.pdftron.pdf.controls.EditToolbarImpl.OnEditToolbarListener
From interface com.pdftron.pdf.controls.FormToolbar.FormToolbarListener
From interface com.pdftron.pdf.tools.AdvancedShapeCreate.OnEditToolbarListener
From interface com.pdftron.pdf.tools.ToolManager.ToolChangedListener

Constants

public static final String PREF_KEY_LINE

Constant Value: "pref_line"

public static final String PREF_KEY_NOTE

Constant Value: "pref_note"

public static final String PREF_KEY_RECT

Constant Value: "pref_rect"

public static final String PREF_KEY_TEXT

Constant Value: "pref_text"

public static final int START_MODE_EDIT_TOOLBAR

Starts with edit toolbar

Constant Value: 1 (0x00000001)

public static final int START_MODE_FILL_AND_SIGN_TOOLBAR

Constant Value: 3 (0x00000003)

public static final int START_MODE_FORM_TOOLBAR

Constant Value: 2 (0x00000002)

public static final int START_MODE_NORMAL_TOOLBAR

Starts with regular annotation toolbar

Constant Value: 0 (0x00000000)

Public Constructors

public AnnotationToolbar (Context context)

Class constructor

public AnnotationToolbar (Context context, AttributeSet attrs)

Class constructor

public AnnotationToolbar (Context context, AttributeSet attrs, int defStyleAttr)

Class constructor

public AnnotationToolbar (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Class constructor

Public Methods

public boolean canExpand ()

Whether this annotation toolbar has enough tool to fill another row.

Returns
  • true if can be expended, false otherwise

public void close ()

Closes the annotation toolbar.

public void closeEditToolbar ()

The overloaded implementation of closeEditToolbar().

public void closePopups ()

Closes the popup windows.

public int getButtonIdFromAnnotType (int annotType)

public ArrayList<GroupedItem> getGroupItems ()

Gets the annotation type grouping and modify accordingly 1. open shape group: PREF_KEY_LINE 2. close shape group: PREF_KEY_RECT 3. FreeText group: PREF_KEY_TEXT 4. Icon type group: PREF_KEY_NOTE

Returns
  • the grouping

public ToolManager getToolManager ()

Gets the ToolManager associated with this toolbar

Returns
  • the ToolManager

public HashMap<String, Integer> getVisibleAnnotTypeMap ()

Gets the visible annotation type when using grouping

Returns
  • the map

public boolean handleKeyUp (int keyCode, KeyEvent event)

Handles the shortcuts key in the annotation toolbar.

Parameters
keyCode the key code
event the key event
Returns
  • true if it is handled; false otherwise

public boolean hasAllTool ()

public void hideButton (AnnotationToolbarButtonId id)

Hides the toolbar button given a toolbar button id.

Parameters
id of the toolbar button to hide

public boolean isExpanded ()

Whether this annotation toolbar is in expanded mode

Returns
  • true if expanded, false otherwise

public boolean isInEditMode ()

Returns
  • True if the ink toolbar is visible

public boolean isInFormMode ()

public boolean isShowing ()

Returns
  • True if the annotation toolbar is visible

public void onConfigurationChanged (Configuration newConfig)

The overloaded implementation of View#onConfigurationChanged(Configuration).

public void onEditToolbarDismissed ()

The overloaded implementation of onEditToolbarDismissed().

public void onFormToolbarWillClose ()

Called when the form toolbar has been closed.

public void selectTool (View view, int id)

Select a tool.

Parameters
view The view
id The id of the tool to be selected.

public void setAnnotationToolbarListener (AnnotationToolbar.AnnotationToolbarListener listener)

Parameters
listener The listener

public void setButtonStayDown (boolean value)

Specifies whether the button should stay down or return to pan tool after an annotation is created.

Parameters
value True if the button should stay down after an annotation is created

public void setOnUndoRedoListener (UndoRedoPopupWindow.OnUndoRedoListener listener)

Parameters
listener The listener

public void setup (ToolManager toolManager)

Setups the annotation toolbar window.

Parameters
toolManager The toolManager class

public void setup (ToolManager toolManager, UndoRedoPopupWindow.OnUndoRedoListener listener)

Setups the annotation toolbar window.

Parameters
toolManager The toolManager class
listener The listener for undo/redo events

public void show (int mode, Annot inkAnnot, int pageNum, ToolManager.ToolMode toolMode, boolean dismissAfterExitEdit)

Shows the annotation toolbar.

Parameters
mode The mode that annotation toolbar should start with. Possible values are START_MODE_NORMAL_TOOLBAR, START_MODE_EDIT_TOOLBAR, START_MODE_FORM_TOOLBAR START_MODE_FILL_AND_SIGN_TOOLBAR
inkAnnot The ink annotation if the mode is START_MODE_EDIT_TOOLBAR and the tool is Ink
toolMode The tool mode that annotation toolbar should start with
dismissAfterExitEdit If it is true and the mode is START_MODE_EDIT_TOOLBAR, the regular annotation toolbar shouldn't be shown when the edit toolbar is dismissed

public void show ()

Shows the annotation toolbar.

public void show (int mode)

Shows the annotation toolbar.

Parameters
mode The mode that annotation toolbar should start with. Possible values are START_MODE_NORMAL_TOOLBAR, START_MODE_EDIT_TOOLBAR, START_MODE_FORM_TOOLBAR START_MODE_FILL_AND_SIGN_TOOLBAR

public void showButton (AnnotationToolbarButtonId id)

Shows the toolbar button given a toolbar button id.

Parameters
id of the toolbar button to show

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

The overloaded implementation of showEditToolbar(ToolMode, Annot, int).

Parameters
toolMode The tool mode that should be selected when open edit toolbar
inkAnnot The selected annotation

public void showEditToolbar (ToolManager.ToolMode toolMode)

public void showFormToolbar (ToolManager.ToolMode toolMode, int mode)

public void toggleExpanded ()

Toggles the expanded mode in annotation toolbar

public void toolChanged (ToolManager.Tool newTool, ToolManager.Tool oldTool)

The overloaded implementation of toolChanged(ToolManager.Tool, ToolManager.Tool).

Parameters
newTool the new tool
oldTool the old tool

public void updateButtonsVisibility ()

Updates the visibility of the buttons on the annotation toolbar.

setup(ToolManager, OnUndoRedoListener) or setup(ToolManager) must be called (before this method) for this method to take effect.