public class

TextHighlighter

extends Tool
implements GenerateHighlightsTask.Callback
java.lang.Object
   ↳ com.pdftron.pdf.tools.Tool
     ↳ com.pdftron.pdf.tools.TextHighlighter

Class Overview

This class can be used to highlight all search results.

Summary

[Expand]
Inherited Constants
From class com.pdftron.pdf.tools.Tool
[Expand]
Inherited Fields
From class com.pdftron.pdf.tools.Tool
Public Constructors
TextHighlighter(PDFViewCtrl pdfViewCtrl)
Class constructor
Public Methods
void cancel()
Cancel the running search task(s).
void clear()
Clears highlighted text.
int getCreateAnnotType()
Gets what annotation type this tool can create
String getSearchPattern()
ToolManager.ToolModeBase getToolMode()
The overload implementation of getToolMode().
void highlightSelection()
boolean isRunning()
void onClose()
The overload implementation of onClose().
void onDoubleTapZoomAnimationBegin()
The overload implementation of onDoubleTapZoomAnimationBegin().
void onDoubleTapZoomAnimationEnd()
The overload implementation of onDoubleTapZoomAnimationEnd().
void onDraw(Canvas canvas, Matrix tfm)
The overload implementation of onDraw(Canvas, Matrix).
boolean onFlingStop()
The overload implementation of onFlingStop().
void onHighlightsTaskCancelled(int pageStart, int pageEnd)
Called when the task of highlights has been cancelled.
void onHighlightsTaskFinished(Highlights[] highlights, int pageStart, int pageEnd)
Called when the task of highlights has been terminated.
void onLayout(boolean changed, int l, int t, int r, int b)
The overload implementation of onLayout(boolean, int, int, int, int).
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 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).
boolean onUp(MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)
The overload implementation of onUp(MotionEvent, PDFViewCtrl.PriorEventMode).
void setHighlightColors(int highlightColorInDayMode, int highlightColorInNightMode, int selColorInDayMode, int selColorInNightMode)
Sets the highlight colors.
void start(String searchPattern, boolean matchCase, boolean matchWholeWords, boolean useRegularExpressions)
Starts highlighting text.
void start(String searchPattern)
Starts highlighting text.
void stop()
Cancel all tasks and indicate that the TextHighlighter has stopped.
void update()
Updates highlighted text
[Expand]
Inherited Methods
From class com.pdftron.pdf.tools.Tool
From class java.lang.Object
From interface com.pdftron.pdf.asynctask.GenerateHighlightsTask.Callback
From interface com.pdftron.pdf.tools.ToolManager.Tool

Public Constructors

public TextHighlighter (PDFViewCtrl pdfViewCtrl)

Class constructor

Public Methods

public void cancel ()

Cancel the running search task(s). The state of the TextHighlighter will still be "running", so calling classes that depend on the TextHighlighter running will still function the same way.

public void clear ()

Clears highlighted text.

public int getCreateAnnotType ()

Gets what annotation type this tool can create

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

public String getSearchPattern ()

Returns
  • The search pattern

public ToolManager.ToolModeBase getToolMode ()

The overload implementation of getToolMode().

Returns
  • the mode/identifier of this tool.

public void highlightSelection ()

public boolean isRunning ()

Returns
  • True if in highlighting process

public void onClose ()

The overload implementation of onClose().

public void onDoubleTapZoomAnimationBegin ()

The overload implementation of onDoubleTapZoomAnimationBegin().

public void onDoubleTapZoomAnimationEnd ()

The overload implementation of onDoubleTapZoomAnimationEnd().

public void onDraw (Canvas canvas, Matrix tfm)

The overload implementation of onDraw(Canvas, Matrix).

public boolean onFlingStop ()

The overload implementation of onFlingStop().

public void onHighlightsTaskCancelled (int pageStart, int pageEnd)

Called when the task of highlights has been cancelled.

Parameters
pageStart The start page
pageEnd The end page

public void onHighlightsTaskFinished (Highlights[] highlights, int pageStart, int pageEnd)

Called when the task of highlights has been terminated.

Parameters
highlights The output highlights
pageStart The start page
pageEnd The end page

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

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

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 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 boolean onUp (MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)

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

public void setHighlightColors (int highlightColorInDayMode, int highlightColorInNightMode, int selColorInDayMode, int selColorInNightMode)

Sets the highlight colors.

Parameters
highlightColorInDayMode highlight color in day mode
highlightColorInNightMode highlight color in night mode
selColorInDayMode Selection color in day mode
selColorInNightMode Selection color in night mode

public void start (String searchPattern, boolean matchCase, boolean matchWholeWords, boolean useRegularExpressions)

Starts highlighting text.

Parameters
searchPattern The search pattern
matchCase True if match case is enabled
matchWholeWords True if whole word is enabled
useRegularExpressions True if regular expressions is enabled

public void start (String searchPattern)

Starts highlighting text.

The search pattern doesn't need to match case or match the whole word. See start(String, boolean, boolean, boolean).

Parameters
searchPattern The search pattern

public void stop ()

Cancel all tasks and indicate that the TextHighlighter has stopped. This method should be used instead of just cancel() if the search will not be continued.

public void update ()

Updates highlighted text