public abstract class

Tool

extends Object
implements ToolManager.Tool
java.lang.Object
   ↳ com.pdftron.pdf.tools.Tool
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The base class that implements the ToolManager.Tool interface and several basic tool functionalities.

Summary

Constants
String ANNOTATION_FREE_TEXT_FONTS
String ANNOTATION_FREE_TEXT_JSON_FONT
String ANNOTATION_FREE_TEXT_JSON_FONT_DISPLAY_IN_LIST
String ANNOTATION_FREE_TEXT_JSON_FONT_DISPLAY_NAME
String ANNOTATION_FREE_TEXT_JSON_FONT_FILE_PATH
String ANNOTATION_FREE_TEXT_JSON_FONT_NAME
String ANNOTATION_FREE_TEXT_JSON_FONT_PDFTRON_NAME
int ANNOTATION_FREE_TEXT_PREFERENCE_DIALOG
String ANNOTATION_FREE_TEXT_PREFERENCE_EDITING
int ANNOTATION_FREE_TEXT_PREFERENCE_EDITING_DEFAULT
int ANNOTATION_FREE_TEXT_PREFERENCE_INLINE
String ANNOTATION_NOTE_ICON_FILE_POSTFIX_FILL
String ANNOTATION_NOTE_ICON_FILE_POSTFIX_OUTLINE
String ANNOTATION_NOTE_ICON_FILE_PREFIX
String ANNOTATION_TOOLBAR_SIGNATURE_STATE
int ANNOT_PERMISSION_MENU
int ANNOT_PERMISSION_SELECTION
String FORM_FIELD_SYMBOL_CHECKBOX
String FORM_FIELD_SYMBOL_CIRCLE
String FORM_FIELD_SYMBOL_CROSS
String FORM_FIELD_SYMBOL_DIAMOND
String FORM_FIELD_SYMBOL_SQUARE
String FORM_FIELD_SYMBOL_STAR
String KEYS
String LAST_DEVICE_LOCALE_LANGUAGE
String METHOD_FROM
String PAGE_NUMBER
String PDFTRON_ID
String PDFTRON_THICKNESS
String PREF_ANNOTATION_CREATION_ARROW
String PREF_ANNOTATION_CREATION_CLOUD
String PREF_ANNOTATION_CREATION_COLOR
String PREF_ANNOTATION_CREATION_ERASER
String PREF_ANNOTATION_CREATION_FILL_COLOR
String PREF_ANNOTATION_CREATION_FONT
String PREF_ANNOTATION_CREATION_FREEHAND
String PREF_ANNOTATION_CREATION_FREETEXT
String PREF_ANNOTATION_CREATION_FREE_HIGHLIGHTER
String PREF_ANNOTATION_CREATION_HIGHLIGHT
String PREF_ANNOTATION_CREATION_ICON
String PREF_ANNOTATION_CREATION_LINE
String PREF_ANNOTATION_CREATION_LINK
String PREF_ANNOTATION_CREATION_NOTE
String PREF_ANNOTATION_CREATION_OPACITY
String PREF_ANNOTATION_CREATION_OVAL
String PREF_ANNOTATION_CREATION_POLYGON
String PREF_ANNOTATION_CREATION_POLYLINE
String PREF_ANNOTATION_CREATION_RECTANGLE
String PREF_ANNOTATION_CREATION_SIGNATURE
String PREF_ANNOTATION_CREATION_SQUIGGLY
String PREF_ANNOTATION_CREATION_STRIKEOUT
String PREF_ANNOTATION_CREATION_TEXT_COLOR
String PREF_ANNOTATION_CREATION_TEXT_SIZE
String PREF_ANNOTATION_CREATION_THICKNESS
String PREF_ANNOTATION_CREATION_UNDERLINE
String PREF_TRANSLATION_SOURCE_LANGUAGE_CODE_DEFAULT
String PREF_TRANSLATION_SOURCE_LANGUAGE_CODE_KEY
String PREF_TRANSLATION_TARGET_LANGUAGE_CODE_DEFAULT
String PREF_TRANSLATION_TARGET_LANGUAGE_CODE_KEY
int QM_MAX_ROW_SIZE
String STAMP_SHOW_FLATTEN_WARNING
Fields
public static final String[] ANNOTATION_FREE_TEXT_WHITELIST_FONTS
protected boolean mAllowOneFingerScrollWithStylus
protected boolean mAllowTwoFingerScroll
protected boolean mAllowZoom
protected Annot mAnnot
protected RectF mAnnotBBox
protected int mAnnotPageNum
protected boolean mAnnotPushedBack
protected AnnotView mAnnotView
protected boolean mAvoidLongPressAttempt
protected ToolManager.ToolModeBase mCurrentDefaultToolMode
protected boolean mForceSameNextToolMode
protected boolean mHasMenuPermission
protected boolean mHasSelectionPermission
protected boolean mIsStylus
protected boolean mJustSwitchedFromAnotherTool
protected String[] mMruMenuItems
protected ToolManager.ToolModeBase mNextToolMode
protected String[] mOverflowMenuItems
protected float mPageNumPosAdjust
protected Paint mPaint4PageNum
protected PDFViewCtrl mPdfViewCtrl
protected QuickMenu mQuickMenu
protected int mSelectPageNum
protected boolean mStylusUsed
protected RectF mTempPageDrawingRectF
protected final float mTextSize
protected final float mTextVOffset
protected boolean mUpFromCalloutCreate
protected static boolean sDebug
Public Constructors
Tool(PDFViewCtrl ctrl)
Class constructor
Public Methods
void clearTargetPoint()
Clears the target point.
void closeQuickMenu()
Closes the quick menu
void executeAction(ActionParameter actionParam)
Executes an action with the specified parameters.
static Bundle getAnnotationModificationBundle(Bundle bundle)
abstract int getCreateAnnotType()
Gets what annotation type this tool can create
ToolManager.ToolModeBase getCurrentDefaultToolMode()
static String getFontKey(int annotType)
Returns the storage key string for font
final ToolManager.ToolModeBase getNextToolMode()
The overload implementation of getNextToolMode().
RectF getTextSelectRect(float x, float y)
Gets a rectangle to use when selecting text.
abstract ToolManager.ToolModeBase getToolMode()
The overload implementation of getToolMode().
static SharedPreferences getToolPreferences(Context context)
boolean hasMenuEntry(int menuId)
Whether the current quick menu includes a certain menu type
boolean isCreatingAnnotation()
The overload implementation of isCreatingAnnotation().
boolean isEditAnnotTool()
Whether the purpose of this tool is editing annotation
boolean isEditingAnnot()
boolean isForceSameNextToolMode()
Gets whether the mode that should forcefully remains.
boolean isInsideQuickMenu(float x, float y)
Checks whether the specified point is inside the quick menu layout.
boolean isQuickMenuShown()
check if quick menu is showing
void onAnnotPainterUpdated(int page, long which, CurvePainter painter)
The overload implementation of onAnnotPainterUpdated(int, long, CurvePainter).
void onClose()
The overload implementation of onClose().
void onConfigurationChanged(Configuration newConfig)
The overload implementation of onConfigurationChanged(Configuration).
void onCreate()
Called after the tool is created by ToolManager.
void onCustomEvent(Object o)
The overload implementation of onCustomEvent(Object).
void onDocumentDownloadEvent(PDFViewCtrl.DownloadState state, int page_num, int page_downloaded, int page_count, String message)
boolean onDoubleTap(MotionEvent e)
The overload implementation of onDoubleTap(MotionEvent).
void onDoubleTapEnd(MotionEvent e)
The overload implementation of onDoubleTapEnd(MotionEvent).
boolean onDoubleTapEvent(MotionEvent e)
The overload implementation of onDoubleTapEvent(MotionEvent).
void onDoubleTapZoomAnimationBegin()
The overload implementation of onDoubleTapZoomAnimationBegin().
void onDoubleTapZoomAnimationEnd()
The overload implementation of onDoubleTapZoomAnimationEnd().
boolean onDown(MotionEvent e)
The overload implementation of onDown(MotionEvent).
void onDraw(Canvas canvas, Matrix tfm)
The overload implementation of onDraw(Canvas, Matrix).
boolean onDrawEdgeEffects(Canvas canvas, int width, int verticalOffset)
The overload implementation of onDrawEdgeEffects(Canvas, int, int).
boolean onFlingStop()
The overload implementation of onFlingStop().
boolean onKeyUp(int keyCode, KeyEvent event)
The overload implementation of onKeyUp(int, KeyEvent).
void onLayout(boolean changed, int l, int t, int r, int b)
The overload implementation of onLayout(boolean, int, int, int, int).
boolean onLongPress(MotionEvent e)
The overload implementation of onLongPress(MotionEvent).
boolean onMove(MotionEvent e1, MotionEvent e2, float x_dist, float y_dist)
The overload implementation of onMove(MotionEvent, MotionEvent, float, float).
void onNightModeUpdated(boolean isNightMode)
The overload implementation of onNightModeUpdated(boolean).
void onPageTurning(int old_page, int cur_page)
The overload implementation of onPageTurning(int, int).
boolean onPointerDown(MotionEvent e)
The overload implementation of onPointerDown(MotionEvent).
void onPostSingleTapConfirmed()
The overload implementation of onPostSingleTapConfirmed().
void onPullEdgeEffects(int whichEdge, float deltaDistance)
The overload implementation of onPullEdgeEffects(int, float).
boolean onQuickMenuClicked(QuickMenuItem menuItem)
Called when a menu in quick menu has been clicked.
void onReleaseEdgeEffects()
The overload implementation of onReleaseEdgeEffects().
void onRenderingFinished()
The overload implementation of onRenderingFinished().
boolean onScale(float x, float y)
The overload implementation of onScale(float, float).
boolean onScaleBegin(float x, float y)
The overload implementation of onScaleBegin(float, float).
boolean onScaleEnd(float x, float y)
The overload implementation of onScaleEnd(float, float).
void onScrollChanged(int l, int t, int oldl, int oldt)
The overload implementation of onScrollChanged(int, int, int, int).
void onSetDoc()
The overload implementation of onSetDoc().
boolean onShowPress(MotionEvent e)
The overload implementation of onShowPress(MotionEvent).
boolean onSingleTapConfirmed(MotionEvent e)
The overload implementation of onSingleTapConfirmed(MotionEvent).
boolean onSingleTapUp(MotionEvent e)
The overload implementation of onSingleTapUp(MotionEvent).
boolean onUp(MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)
The overload implementation of onUp(MotionEvent, PDFViewCtrl.PriorEventMode).
void selectAnnot(Annot annot, int pageNum)
Selects the specified annotation.
static void setDebug(boolean debug)
void setForceSameNextToolMode(boolean mode)
Specifies the mode that should forcefully remains.
void setNextToolModeHelper(ToolManager.ToolMode nextToolMode)
Uses a helper to set the next tool mode.
void setPageNumberIndicatorVisible(boolean visible)
Sets the visiblity of page number indicator.
void setupAnnotProperty(int color, float opacity, float thickness, int fillColor, String icon, String pdfTronFontName, int textColor, float textSize)
Setup annotation properties.
void setupAnnotProperty(AnnotStyle annotStyle)
Setup annotation properties.
void setupAnnotProperty(int color, float opacity, float thickness, int fillColor, String icon, String pdfTronFontName)
Setup annotation properties.
boolean showMenu(RectF anchor_rect, QuickMenu quickMenu)
Shows the quick menu with given menu.
boolean showMenu(RectF anchor_rect)
Shows the quick menu.
void updateQuickMenuNoteText(String note)
Update quick menu note text based on if the note has contents
void updateQuickMenuStyleColor(int color)
Update quick menu appearance item color
void updateQuickMenuStyleOpacity(float opacity)
Protected Methods
boolean addAnnotView()
Adds real time annotation view
void addOldTools()
Adds old tools.
void buildAnnotBBox()
Builds the bounding box of the annotation.
RectF calculateQMAnchor(RectF anchorRect)
Calculates quick menu anchor
boolean canAddAnnotView(Annot annot, AnnotStyle annotStyle)
float convDp2Pix(float dp)
Converts density independent pixels to physical pixels.
float convPix2Dp(float pix)
Converts physical pixels to density independent pixels.
com.pdftron.pdf.Rect convertFromPageRectToScreenRect(com.pdftron.pdf.Rect pageRect, int page)
Converts from page rect to screen rect
Obj createFormFieldAppearance(PDFDoc doc, String symbol)
Creates the formfield appearance.
QuickMenu createQuickMenu()
creates a quick menu.
void customizeQuickMenuItems(QuickMenu quickMenu)
Customize quick menu item inside quick menu
void deleteAnnot()
Deletes the annotation.
void doneOneFingerScrollingWithStylus()
Called when done with one finger scrolling with stylus.
void doneTwoFingerScrolling()
Called when doen with two finger scrolling.
void flattenAnnot()
Flattens the annotation.
RectF getAnnotCanvasRect()
Gets annotation rectangle in canvas pt.
RectF getAnnotRect()
Gets annotation rectangle in screen pt
String getColorFillKey(int annotType)
Returns the storage key string for color fill
String getColorKey(int annotType)
Returns the storage key string for color
String getIconKey(int annotType)
Returns the storage key string for icon
int getModeAHLabel()
static ToolManager.ToolMode getModeFromAnnotType(Annot annot)
get tool mode from annotation type
String getOpacityKey(int annotType)
Returns the storage key string for opacity
int getQuickMenuAnalyticType()
Gets quick menu type for analytics
Rect getRectFromRectF(RectF rectF)
String getRulerBaseUnitKey(int annotType)
Returns the storage key string for ruler base unit
String getRulerBaseValueKey(int annotType)
Returns the storage key string for ruler base value
String getRulerTranslateUnitKey(int annotType)
Returns the storage key string for ruler translate unit
String getRulerTranslateValueKey(int annotType)
Returns the storage key string for ruler translate value
String getStringFromResId(int id)
Returns string from resource ID
String getTextColorKey(int annotType)
Returns the storage key string for text color
String getTextSizeKey(int annotType)
String getThicknessKey(int annotType)
Returns the storage key string for thickness
void handleFlattenAnnot()
Handles flattening the annotation.
boolean hasPermission(Annot annot, int kind)
Checks whether the annotation has the specified permission
boolean isInsideAnnot(MotionEvent e)
Checks if given screen point is inside selected annotaiton
final boolean onInterceptAnnotationHandling(Annot annot)
Handle annotation
final boolean onInterceptAnnotationHandling(Annot annot, Bundle bundle)
Handle annotation
boolean onInterceptDialogEvent(AlertDialog dialog)
Call this function when a dialog is about to show up.
void raiseAnnotationActionEvent()
Called when an annotations action has been taken place.
void raiseAnnotationAddedEvent(Annot annot, int page)
Called when an annotation is added.
void raiseAnnotationAddedEvent(Map<Annot, Integer> annots)
Called when annotation are added.
void raiseAnnotationModifiedEvent(Annot annot, int page, Bundle bundle)
void raiseAnnotationModifiedEvent(Annot annot, int page)
Called when an annotation is modified.
void raiseAnnotationModifiedEvent(Map<Annot, Integer> annots)
Called when annotation are modified.
void raiseAnnotationPreModifyEvent(Map<Annot, Integer> annots)
Called when annotation are going to be modified.
void raiseAnnotationPreModifyEvent(Annot annot, int page)
Called right before an annotation is modified.
void raiseAnnotationPreRemoveEvent(Annot annot, int page)
Called right before an annotation is removed.
void raiseAnnotationPreRemoveEvent(Map<Annot, Integer> annots)
Called when annotation are going to be removed.
void raiseAnnotationRemovedEvent(Annot annot, int page)
Called when an annotation is removed.
void raiseAnnotationRemovedEvent(Map<Annot, Integer> annots)
Called when annotation are removed.
void removeAnnotView()
void removeAnnotView(boolean delayRemoval)
ToolManager.ToolModeBase safeSetNextToolMode(ToolManager.ToolModeBase toolMode)
get acutal next tool mode safely
void setAnnot(Annot annot, int pageNum)
Sets the annotataion
void setAuthor(Markup annot)
Sets the author
void setCurrentDefaultToolModeHelper(ToolManager.ToolModeBase defaultToolMode)
Uses a helper to set current default tool mode.
void setDateToNow(Annot annot)
set annotation date to now
void setJustCreatedFromAnotherTool()
Lets the tool know that it is just switched from annotation tool.
void setUniqueID(Markup annot)
set unique id to annotation
void showTransientPageNumber()
Shows transient page number.
boolean skipOnUpPriorEvent(PDFViewCtrl.PriorEventMode priorEventMode)
Checks whether should skip on up based on the prior event
void unsetAnnot()
Unsets the annotation.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pdftron.pdf.tools.ToolManager.Tool

Constants

public static final String ANNOTATION_FREE_TEXT_FONTS

Constant Value: "annotation_property_free_text_fonts_list"

public static final String ANNOTATION_FREE_TEXT_JSON_FONT

Constant Value: "fonts"

public static final String ANNOTATION_FREE_TEXT_JSON_FONT_DISPLAY_IN_LIST

Constant Value: "display font"

public static final String ANNOTATION_FREE_TEXT_JSON_FONT_DISPLAY_NAME

Constant Value: "display name"

public static final String ANNOTATION_FREE_TEXT_JSON_FONT_FILE_PATH

Constant Value: "filepath"

public static final String ANNOTATION_FREE_TEXT_JSON_FONT_NAME

Constant Value: "font name"

public static final String ANNOTATION_FREE_TEXT_JSON_FONT_PDFTRON_NAME

Constant Value: "pdftron name"

public static final int ANNOTATION_FREE_TEXT_PREFERENCE_DIALOG

Constant Value: 2 (0x00000002)

public static final String ANNOTATION_FREE_TEXT_PREFERENCE_EDITING

Constant Value: "annotation_free_text_preference_editing"

public static final int ANNOTATION_FREE_TEXT_PREFERENCE_EDITING_DEFAULT

Constant Value: 1 (0x00000001)

public static final int ANNOTATION_FREE_TEXT_PREFERENCE_INLINE

Constant Value: 1 (0x00000001)

public static final String ANNOTATION_NOTE_ICON_FILE_POSTFIX_FILL

Constant Value: "_fill"

public static final String ANNOTATION_NOTE_ICON_FILE_POSTFIX_OUTLINE

Constant Value: "_outline"

public static final String ANNOTATION_NOTE_ICON_FILE_PREFIX

Constant Value: "annotation_note_icon_"

public static final String ANNOTATION_TOOLBAR_SIGNATURE_STATE

Constant Value: "annotation_toolbar_signature_state"

public static final int ANNOT_PERMISSION_MENU

Constant Value: 1 (0x00000001)

public static final int ANNOT_PERMISSION_SELECTION

Constant Value: 0 (0x00000000)

public static final String FORM_FIELD_SYMBOL_CHECKBOX

Constant Value: "4"

public static final String FORM_FIELD_SYMBOL_CIRCLE

Constant Value: "l"

public static final String FORM_FIELD_SYMBOL_CROSS

Constant Value: "8"

public static final String FORM_FIELD_SYMBOL_DIAMOND

Constant Value: "u"

public static final String FORM_FIELD_SYMBOL_SQUARE

Constant Value: "n"

public static final String FORM_FIELD_SYMBOL_STAR

Constant Value: "H"

public static final String KEYS

Constant Value: "PDFTRON_KEYS"

public static final String LAST_DEVICE_LOCALE_LANGUAGE

Constant Value: "last_device_locale_language"

public static final String METHOD_FROM

Constant Value: "METHOD_FROM"

public static final String PAGE_NUMBER

Constant Value: "PAGE_NUMBER"

public static final String PDFTRON_ID

Constant Value: "pdftron"

public static final String PDFTRON_THICKNESS

Constant Value: "pdftron_thickness"

public static final String PREF_ANNOTATION_CREATION_ARROW

Constant Value: "annotation_creation_arrow"

public static final String PREF_ANNOTATION_CREATION_CLOUD

Constant Value: "annotation_creation_cloud"

public static final String PREF_ANNOTATION_CREATION_COLOR

Constant Value: "_color"

public static final String PREF_ANNOTATION_CREATION_ERASER

Constant Value: "annotation_creation_eraser"

public static final String PREF_ANNOTATION_CREATION_FILL_COLOR

Constant Value: "_fill_color"

public static final String PREF_ANNOTATION_CREATION_FONT

Constant Value: "_font"

public static final String PREF_ANNOTATION_CREATION_FREEHAND

Constant Value: "annotation_creation_freehand"

public static final String PREF_ANNOTATION_CREATION_FREETEXT

Constant Value: "annotation_creation_freetext"

public static final String PREF_ANNOTATION_CREATION_FREE_HIGHLIGHTER

Constant Value: "annotation_creation_free_highlighter"

public static final String PREF_ANNOTATION_CREATION_HIGHLIGHT

Constant Value: "annotation_creation_highlight"

public static final String PREF_ANNOTATION_CREATION_ICON

Constant Value: "_icon"

public static final String PREF_ANNOTATION_CREATION_LINE

Constant Value: "annotation_creation"

public static final String PREF_ANNOTATION_CREATION_LINK

Constant Value: "annotation_creation_link"

public static final String PREF_ANNOTATION_CREATION_NOTE

Constant Value: "annotation_creation_note"

public static final String PREF_ANNOTATION_CREATION_OPACITY

Constant Value: "_opacity"

public static final String PREF_ANNOTATION_CREATION_OVAL

Constant Value: "annotation_creation_oval"

public static final String PREF_ANNOTATION_CREATION_POLYGON

Constant Value: "annotation_creation_polygon"

public static final String PREF_ANNOTATION_CREATION_POLYLINE

Constant Value: "annotation_creation_polyline"

public static final String PREF_ANNOTATION_CREATION_RECTANGLE

Constant Value: "annotation_creation_rectangle"

public static final String PREF_ANNOTATION_CREATION_SIGNATURE

Constant Value: "annotation_creation_signature"

public static final String PREF_ANNOTATION_CREATION_SQUIGGLY

Constant Value: "annotation_creation_squiggly"

public static final String PREF_ANNOTATION_CREATION_STRIKEOUT

Constant Value: "annotation_creation_strikeout"

public static final String PREF_ANNOTATION_CREATION_TEXT_COLOR

Constant Value: "_text_color"

public static final String PREF_ANNOTATION_CREATION_TEXT_SIZE

Constant Value: "_text_size"

public static final String PREF_ANNOTATION_CREATION_THICKNESS

Constant Value: "_thickness"

public static final String PREF_ANNOTATION_CREATION_UNDERLINE

Constant Value: "annotation_creation_text_markup"

public static final String PREF_TRANSLATION_SOURCE_LANGUAGE_CODE_DEFAULT

Constant Value: "en"

public static final String PREF_TRANSLATION_SOURCE_LANGUAGE_CODE_KEY

Constant Value: "translation_source_language_code"

public static final String PREF_TRANSLATION_TARGET_LANGUAGE_CODE_DEFAULT

Constant Value: "fr"

public static final String PREF_TRANSLATION_TARGET_LANGUAGE_CODE_KEY

Constant Value: "translation_target_language_code"

public static final int QM_MAX_ROW_SIZE

Constant Value: 4 (0x00000004)

public static final String STAMP_SHOW_FLATTEN_WARNING

Constant Value: "stamp_show_flatten_warning"

Fields

public static final String[] ANNOTATION_FREE_TEXT_WHITELIST_FONTS

protected boolean mAllowOneFingerScrollWithStylus

protected boolean mAllowTwoFingerScroll

protected boolean mAllowZoom

protected Annot mAnnot

protected RectF mAnnotBBox

protected int mAnnotPageNum

protected boolean mAnnotPushedBack

protected AnnotView mAnnotView

protected boolean mAvoidLongPressAttempt

protected ToolManager.ToolModeBase mCurrentDefaultToolMode

protected boolean mForceSameNextToolMode

protected boolean mHasMenuPermission

protected boolean mHasSelectionPermission

protected boolean mIsStylus

protected boolean mJustSwitchedFromAnotherTool

protected String[] mMruMenuItems

protected ToolManager.ToolModeBase mNextToolMode

protected String[] mOverflowMenuItems

protected float mPageNumPosAdjust

protected Paint mPaint4PageNum

protected PDFViewCtrl mPdfViewCtrl

protected QuickMenu mQuickMenu

protected int mSelectPageNum

protected boolean mStylusUsed

protected RectF mTempPageDrawingRectF

protected final float mTextSize

protected final float mTextVOffset

protected boolean mUpFromCalloutCreate

protected static boolean sDebug

Public Constructors

public Tool (PDFViewCtrl ctrl)

Class constructor

Public Methods

public void clearTargetPoint ()

Clears the target point.

public void closeQuickMenu ()

Closes the quick menu

public void executeAction (ActionParameter actionParam)

Executes an action with the specified parameters.

Note that the PDF doc should have been locked when call this method. In addition, ToolManager's raise annotation should be handled in the caller function.

Parameters
actionParam The action parameters

public static Bundle getAnnotationModificationBundle (Bundle bundle)

public abstract int getCreateAnnotType ()

Gets what annotation type this tool can create

Returns
  • annot type for annotation creation tool, or unknown for non-creation tool.

public ToolManager.ToolModeBase getCurrentDefaultToolMode ()

Returns
  • The current default tool mode

public static String getFontKey (int annotType)

Returns the storage key string for font

Parameters
annotType The annotation type
Returns
  • The storage key string

public final ToolManager.ToolModeBase getNextToolMode ()

The overload implementation of getNextToolMode().

Returns
  • the mode of the next tool. Via this method, a tool can indicate the next tool to switch to.

public RectF getTextSelectRect (float x, float y)

Gets a rectangle to use when selecting text.

public abstract ToolManager.ToolModeBase getToolMode ()

The overload implementation of getToolMode().

Returns
  • the mode/identifier of this tool.

public static SharedPreferences getToolPreferences (Context context)

public boolean hasMenuEntry (int menuId)

Whether the current quick menu includes a certain menu type

Parameters
menuId the menu item id

public boolean isCreatingAnnotation ()

The overload implementation of isCreatingAnnotation().

public boolean isEditAnnotTool ()

Whether the purpose of this tool is editing annotation

Returns
  • false

public boolean isEditingAnnot ()

Returns
  • True if the annotation is editing

public boolean isForceSameNextToolMode ()

Gets whether the mode that should forcefully remains.

public boolean isInsideQuickMenu (float x, float y)

Checks whether the specified point is inside the quick menu layout.

Parameters
x X coordinates
y Y coordinates
Returns
  • True if it is inside quick menu, false otherwise

public boolean isQuickMenuShown ()

check if quick menu is showing

Returns
  • true if quick menu is visible

public void onAnnotPainterUpdated (int page, long which, CurvePainter painter)

The overload implementation of onAnnotPainterUpdated(int, long, CurvePainter).

public void onClose ()

The overload implementation of onClose().

public void onConfigurationChanged (Configuration newConfig)

The overload implementation of onConfigurationChanged(Configuration).

public void onCreate ()

Called after the tool is created by ToolManager.

public void onCustomEvent (Object o)

The overload implementation of onCustomEvent(Object).

public void onDocumentDownloadEvent (PDFViewCtrl.DownloadState state, int page_num, int page_downloaded, int page_count, String message)

public boolean onDoubleTap (MotionEvent e)

The overload implementation of onDoubleTap(MotionEvent).

public void onDoubleTapEnd (MotionEvent e)

The overload implementation of onDoubleTapEnd(MotionEvent).

public boolean onDoubleTapEvent (MotionEvent e)

The overload implementation of onDoubleTapEvent(MotionEvent).

public void onDoubleTapZoomAnimationBegin ()

The overload implementation of onDoubleTapZoomAnimationBegin().

public void onDoubleTapZoomAnimationEnd ()

The overload implementation of onDoubleTapZoomAnimationEnd().

public boolean onDown (MotionEvent e)

The overload implementation of onDown(MotionEvent).

public void onDraw (Canvas canvas, Matrix tfm)

The overload implementation of onDraw(Canvas, Matrix).

public boolean onDrawEdgeEffects (Canvas canvas, int width, int verticalOffset)

The overload implementation of onDrawEdgeEffects(Canvas, int, int).

public boolean onFlingStop ()

The overload implementation of onFlingStop().

public boolean onKeyUp (int keyCode, KeyEvent event)

The overload implementation of onKeyUp(int, KeyEvent).

public void onLayout (boolean changed, int l, int t, int r, int b)

The overload implementation of onLayout(boolean, int, int, int, int).

public boolean onLongPress (MotionEvent e)

The overload implementation of onLongPress(MotionEvent).

public boolean onMove (MotionEvent e1, MotionEvent e2, float x_dist, float y_dist)

The overload implementation of onMove(MotionEvent, MotionEvent, float, float).

public void onNightModeUpdated (boolean isNightMode)

The overload implementation of onNightModeUpdated(boolean).

public void onPageTurning (int old_page, int cur_page)

The overload implementation of onPageTurning(int, int).

public boolean onPointerDown (MotionEvent e)

The overload implementation of onPointerDown(MotionEvent).

public void onPostSingleTapConfirmed ()

The overload implementation of onPostSingleTapConfirmed().

public void onPullEdgeEffects (int whichEdge, float deltaDistance)

The overload implementation of onPullEdgeEffects(int, float).

public boolean onQuickMenuClicked (QuickMenuItem menuItem)

Called when a menu in quick menu has been clicked.

Parameters
menuItem The clicked menu item.
Returns
  • True if handled

public void onReleaseEdgeEffects ()

The overload implementation of onReleaseEdgeEffects().

public void onRenderingFinished ()

The overload implementation of onRenderingFinished().

public boolean onScale (float x, float y)

The overload implementation of onScale(float, float).

public boolean onScaleBegin (float x, float y)

The overload implementation of onScaleBegin(float, float).

public boolean onScaleEnd (float x, float y)

The overload implementation of onScaleEnd(float, float).

public void onScrollChanged (int l, int t, int oldl, int oldt)

The overload implementation of onScrollChanged(int, int, int, int).

public void onSetDoc ()

The overload implementation of onSetDoc().

public boolean onShowPress (MotionEvent e)

The overload implementation of onShowPress(MotionEvent).

public boolean onSingleTapConfirmed (MotionEvent e)

The overload implementation of onSingleTapConfirmed(MotionEvent).

public boolean onSingleTapUp (MotionEvent e)

The overload implementation of onSingleTapUp(MotionEvent).

public boolean onUp (MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)

The overload implementation of onUp(MotionEvent, PDFViewCtrl.PriorEventMode).

public void selectAnnot (Annot annot, int pageNum)

Selects the specified annotation.

Parameters
annot The annotaion
pageNum The page number where the annotaion is on

public static void setDebug (boolean debug)

public void setForceSameNextToolMode (boolean mode)

Specifies the mode that should forcefully remains.

public void setNextToolModeHelper (ToolManager.ToolMode nextToolMode)

Uses a helper to set the next tool mode.

Parameters
nextToolMode The next tool mode

public void setPageNumberIndicatorVisible (boolean visible)

Sets the visiblity of page number indicator.

Parameters
visible True if visibla

public void setupAnnotProperty (int color, float opacity, float thickness, int fillColor, String icon, String pdfTronFontName, int textColor, float textSize)

Setup annotation properties.

Parameters
color The color
opacity The opacity
thickness The thickness
fillColor The color for filling
icon The icon
pdfTronFontName The PDFTron font name
textColor The text color
textSize The text size

public void setupAnnotProperty (AnnotStyle annotStyle)

Setup annotation properties.

public void setupAnnotProperty (int color, float opacity, float thickness, int fillColor, String icon, String pdfTronFontName)

Setup annotation properties.

Parameters
color The color
opacity The opacity
thickness The thickness
fillColor The color for filling
icon The icon
pdfTronFontName The PDFTron font name

public boolean showMenu (RectF anchor_rect, QuickMenu quickMenu)

Shows the quick menu with given menu.

public boolean showMenu (RectF anchor_rect)

Shows the quick menu.

public void updateQuickMenuNoteText (String note)

Update quick menu note text based on if the note has contents

Parameters
note the content of note

public void updateQuickMenuStyleColor (int color)

Update quick menu appearance item color

public void updateQuickMenuStyleOpacity (float opacity)

Protected Methods

protected boolean addAnnotView ()

Adds real time annotation view

Returns
  • true if a view is added, false otherwise

protected void addOldTools ()

Adds old tools.

protected void buildAnnotBBox ()

Builds the bounding box of the annotation.

protected RectF calculateQMAnchor (RectF anchorRect)

Calculates quick menu anchor

Parameters
anchorRect The anchor rectangle
Returns
  • The rectangle

protected boolean canAddAnnotView (Annot annot, AnnotStyle annotStyle)

protected float convDp2Pix (float dp)

Converts density independent pixels to physical pixels.

protected float convPix2Dp (float pix)

Converts physical pixels to density independent pixels.

protected com.pdftron.pdf.Rect convertFromPageRectToScreenRect (com.pdftron.pdf.Rect pageRect, int page)

Converts from page rect to screen rect

Parameters
pageRect The page rect
page The page number
Returns
  • The screen rect

protected Obj createFormFieldAppearance (PDFDoc doc, String symbol)

Creates the formfield appearance. Default to checkmark. Can be overridden for other appearances.

Parameters
doc the PDFDoc
symbol the appearance symbol "4" = Checkbox "l" = Circle "8" = Cross "u" = Diamond "n" = Square "H" = Star
Returns
  • appearance stream
Throws
PDFNet exception
PDFNetException

protected QuickMenu createQuickMenu ()

creates a quick menu. It is used for showMenu(RectF)

Returns
  • quick menu

protected void customizeQuickMenuItems (QuickMenu quickMenu)

Customize quick menu item inside quick menu

protected void deleteAnnot ()

Deletes the annotation.

protected void doneOneFingerScrollingWithStylus ()

Called when done with one finger scrolling with stylus.

protected void doneTwoFingerScrolling ()

Called when doen with two finger scrolling.

protected void flattenAnnot ()

Flattens the annotation.

protected RectF getAnnotCanvasRect ()

Gets annotation rectangle in canvas pt.

Returns
  • annotation rectangle in canvas pt.

protected RectF getAnnotRect ()

Gets annotation rectangle in screen pt

Returns
  • annnotation rectangle in screen pt.

protected String getColorFillKey (int annotType)

Returns the storage key string for color fill

Parameters
annotType The annotation type
Returns
  • The storage key string

protected String getColorKey (int annotType)

Returns the storage key string for color

Parameters
annotType The annotation type
Returns
  • The storage key string

protected String getIconKey (int annotType)

Returns the storage key string for icon

Parameters
annotType The annotation type
Returns
  • The storage key string

protected int getModeAHLabel ()

Returns
  • analytics handler label mode

protected static ToolManager.ToolMode getModeFromAnnotType (Annot annot)

get tool mode from annotation type

Parameters
annot annotation
Returns
  • tool mode

protected String getOpacityKey (int annotType)

Returns the storage key string for opacity

Parameters
annotType The annotation type
Returns
  • The storage key string

protected int getQuickMenuAnalyticType ()

Gets quick menu type for analytics

Returns
  • quick menu type

protected Rect getRectFromRectF (RectF rectF)

protected String getRulerBaseUnitKey (int annotType)

Returns the storage key string for ruler base unit

Returns
  • The storage key string

protected String getRulerBaseValueKey (int annotType)

Returns the storage key string for ruler base value

Returns
  • The storage key string

protected String getRulerTranslateUnitKey (int annotType)

Returns the storage key string for ruler translate unit

Returns
  • The storage key string

protected String getRulerTranslateValueKey (int annotType)

Returns the storage key string for ruler translate value

Returns
  • The storage key string

protected String getStringFromResId (int id)

Returns string from resource ID

Parameters
id The resource ID
Returns
  • The string from resource ID

protected String getTextColorKey (int annotType)

Returns the storage key string for text color

Returns
  • the storage key string for text color

protected String getTextSizeKey (int annotType)

protected String getThicknessKey (int annotType)

Returns the storage key string for thickness

Parameters
annotType The annotation type
Returns
  • The storage key string

protected void handleFlattenAnnot ()

Handles flattening the annotation. Checks if the user does indeed want to flatten the annotation.

protected boolean hasPermission (Annot annot, int kind)

Checks whether the annotation has the specified permission

Parameters
annot The annotation
kind The kind of permission. Possible values are ANNOT_PERMISSION_SELECTION, ANNOT_PERMISSION_MENU
Returns
  • True if the annotation has permission

protected boolean isInsideAnnot (MotionEvent e)

Checks if given screen point is inside selected annotaiton

Parameters
e The motion point
Returns
  • true if inside, false otherwise

protected final boolean onInterceptAnnotationHandling (Annot annot)

Handle annotation

Parameters
annot annotation
Returns
  • true then intercept the subclass function, false otherwise

protected final boolean onInterceptAnnotationHandling (Annot annot, Bundle bundle)

Handle annotation

Parameters
annot annotation which is pending to be handled
bundle information going to pass to ToolManager
Returns
  • true then intercept the subclass function, false otherwise

protected boolean onInterceptDialogEvent (AlertDialog dialog)

Call this function when a dialog is about to show up.

protected void raiseAnnotationActionEvent ()

Called when an annotations action has been taken place.

protected void raiseAnnotationAddedEvent (Annot annot, int page)

Called when an annotation is added.

Parameters
annot The added annotation
page The page where the annotation is on

protected void raiseAnnotationAddedEvent (Map<Annot, Integer> annots)

Called when annotation are added.

Parameters
annots The map of added annotations (pairs of annotation and the page number where the annotation is on)

protected void raiseAnnotationModifiedEvent (Annot annot, int page, Bundle bundle)

protected void raiseAnnotationModifiedEvent (Annot annot, int page)

Called when an annotation is modified.

Parameters
annot The modified annotation
page The page where the annotation is on

protected void raiseAnnotationModifiedEvent (Map<Annot, Integer> annots)

Called when annotation are modified.

Parameters
annots The map of modified annotations (pairs of annotation and the page number where the annotation is on)

protected void raiseAnnotationPreModifyEvent (Map<Annot, Integer> annots)

Called when annotation are going to be modified.

Parameters
annots The map of annotations to be modified (pairs of annotation and the page number where the annotation is on)

protected void raiseAnnotationPreModifyEvent (Annot annot, int page)

Called right before an annotation is modified.

Parameters
annot The annotation to be modified
page The page where the annotation is on

protected void raiseAnnotationPreRemoveEvent (Annot annot, int page)

Called right before an annotation is removed.

Parameters
annot The annotation to removed
page The page where the annotation is on

protected void raiseAnnotationPreRemoveEvent (Map<Annot, Integer> annots)

Called when annotation are going to be removed.

Parameters
annots The map of annotations to be removed (pairs of annotation and the page number where the annotation is on)

protected void raiseAnnotationRemovedEvent (Annot annot, int page)

Called when an annotation is removed.

Parameters
annot The removed annotation
page The page where the annotation is on

protected void raiseAnnotationRemovedEvent (Map<Annot, Integer> annots)

Called when annotation are removed.

Parameters
annots The map of removed annotations (pairs of annotation and the page number where the annotation is on)

protected void removeAnnotView ()

protected void removeAnnotView (boolean delayRemoval)

protected ToolManager.ToolModeBase safeSetNextToolMode (ToolManager.ToolModeBase toolMode)

get acutal next tool mode safely

Parameters
toolMode next tool mode
Returns
  • next tool mode

protected void setAnnot (Annot annot, int pageNum)

Sets the annotataion

Parameters
annot The annotation

protected void setAuthor (Markup annot)

Sets the author

Parameters
annot The markup annotation

protected void setCurrentDefaultToolModeHelper (ToolManager.ToolModeBase defaultToolMode)

Uses a helper to set current default tool mode.

Parameters
defaultToolMode The current default tool mode

protected void setDateToNow (Annot annot)

set annotation date to now

Parameters
annot annotation

protected void setJustCreatedFromAnotherTool ()

Lets the tool know that it is just switched from annotation tool.

protected void setUniqueID (Markup annot)

set unique id to annotation

Parameters
annot mark up annotation

protected void showTransientPageNumber ()

Shows transient page number.

protected boolean skipOnUpPriorEvent (PDFViewCtrl.PriorEventMode priorEventMode)

Checks whether should skip on up based on the prior event

Parameters
priorEventMode The prior event

protected void unsetAnnot ()

Unsets the annotation.