public class

ReflowControl

extends ViewPager
implements ReflowPagerAdapter.ReflowPagerAdapterCallback
java.lang.Object
   ↳ ViewPager
     ↳ com.pdftron.pdf.controls.ReflowControl

Class Overview

This class provides convenient methods for interacting with ReflowPagerAdapter class and takes care of throwing an exception if ReflowPagerAdapter is not set up.

Summary

Nested Classes
interface ReflowControl.OnPostProcessColorListener Callback interface to be invoked to get the processed color  
interface ReflowControl.OnReflowLongPressListener Callback interface to be invoked when a single tap up gesture occurs. 
interface ReflowControl.OnReflowTapListener Callback interface to be invoked when a single tap up gesture occurs. 
interface ReflowControl.ReflowUrlLoadedListener  
Constants
int FOLLOW_PDFVIEWCTRL
int HORIZONTAL
int VERTICAL
Public Constructors
ReflowControl(Context context)
Class constructor
ReflowControl(Context context, AttributeSet attrs)
Class constructor
Public Methods
void addReflowLongPressListener(ReflowControl.OnReflowLongPressListener listener)
Adds a listener that will be invoked by ReflowControl.OnReflowLongPressListener.
void addReflowOnTapListener(ReflowControl.OnReflowTapListener listener)
Adds a listener that will be invoked by ReflowControl.OnReflowTapListener.
void cleanUp()
Cleans up.
void clearAdapterCacheAndReset()
void clearReflowLongPressListeners()
Remove all listeners that are notified of any callback from OnReflowLongPressListener.
void clearReflowOnTapListeners()
Remove all listeners that are notified of any callback from OnTapListener.
void enableTurnPageOnTap(boolean enabled)
Enables turn page on tap.
int getCurrentPage()
Gets the current page.
boolean getIsDoNotReflowTextOverImages()
Gets value to show text over images in reflow mode, default to false.
boolean getIsHideBackgroundImages()
Gets value to show background images in reflow mode, default to false.
boolean getIsHideImagesUnderInvisibleText()
Gets value to show images under invisible text in reflow mode, default to false.
boolean getIsHideImagesUnderText()
Gets value to show images under text in reflow mode, default to false.
int getOrientation()
Gets the paging direction
int getTextSizeInPercent()
Returns the text size.
boolean isCustomColorMode()
Checks whether reflow is in custom color mode.
boolean isDayMode()
Checks whether reflow is in day mode.
boolean isInternalLinkClicked()
Checks whether an internal link is clicked.
boolean isNightMode()
Checks whether reflow is in night mode.
boolean isReady()
Checks whether the reflow control is ready
boolean isRightToLeftDirection()
Checks whether right-to-left mode is enabled.
void notifyPagesModified()
Notifies that pages are modified
boolean onInterceptTouchEvent(MotionEvent ev)
void onReflowPagerLongPress(WebView webView, MotionEvent event)
Called when a long press event happens
void onReflowPagerSingleTapUp(WebView webView, MotionEvent event)
Called when a single tap up event happens
boolean onTouchEvent(MotionEvent ev)
void removeReflowLongPressListener(ReflowControl.OnReflowLongPressListener listener)
Removes a listener that was previously added via addReflowLongPressListener(OnReflowLongPressListener).
void removeReflowOnTapListener(ReflowControl.OnReflowTapListener listener)
Removes a listener that was previously added via addReflowOnTapListener(OnReflowTapListener).
void reset()
Resets the reflow control
void resetInternalLinkClicked()
Resets that an internal link is clicked.
void scrollPageBy(int x, int y)
Scroll the current WebView by x and y.
void setAnnotStyleProperties(HashMap<Integer, AnnotStyleProperty> annotStyleProperties)
Sets the AnnotStyleProperties that will be used to hide elements of the AnnotStyleDialog
void setCurrentPage(int pageNum)
Sets the current page.
void setCustomColorMode(int backgroundColorMode)
Sets reflow in custom color mode.
void setDayMode()
Sets reflow in day mode.
void setDoNotReflowTextOverImages(boolean doNotReflowTextOverImages)
Sets whether to show text over images in reflow mode, default to false.
void setEditingEnabled(boolean editingEnabled)
On Nougat and up, it is possible to edit text markups.
void setHideBackgroundImages(boolean hideBackgroundImages)
Sets whether to show background images in reflow mode, default to false.
void setHideImagesUnderInvisibleText(boolean hideImagesUnderInvisibleText)
Sets whether to show images under invisible text in reflow mode, default to false.
void setHideImagesUnderText(boolean hideImagesUnderText)
Sets whether to show images under text in reflow mode, default to false.
void setImageInReflowEnabled(boolean imageInReflowEnabled)
Sets whether to show images in reflow mode, default to true.
void setNightMode()
Sets reflow in night mode.
void setOnPostProcessColorListener(ReflowControl.OnPostProcessColorListener listener)
Sets the post process color listener
void setOrientation(int orientation)
Sets the paging direction
void setReflowUrlLoadedListener(ReflowControl.ReflowUrlLoadedListener listener)
Sets a ReflowUrlLoadedListener for ReflowPagerAdapterCallback
void setRightToLeftDirection(boolean isRtlMode)
Sets right-to-left mode.
void setTextSelectionMenuEnabled(boolean textSelectionMenuEnabled)
Disables text selection menu webview (long press)
void setTextSizeInPercent(int textSizeInPercent)
Sets the text size.
void setup(PDFDoc pdfDoc, ToolManager toolManager, ReflowControl.OnPostProcessColorListener listener)
Setups the reflow control
void setup(PDFDoc pdfDoc)
Setups the reflow control
void setup(PDFDoc pdfDoc, ReflowControl.OnPostProcessColorListener listener)
Setups the reflow control
void updateTextSize()
Update text size for current page
void zoomIn()
Zooms in.
void zoomOut()
Zooms out.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pdftron.pdf.controls.ReflowPagerAdapter.ReflowPagerAdapterCallback

Constants

public static final int FOLLOW_PDFVIEWCTRL

Constant Value: 2 (0x00000002)

public static final int HORIZONTAL

Constant Value: 0 (0x00000000)

public static final int VERTICAL

Constant Value: 1 (0x00000001)

Public Constructors

public ReflowControl (Context context)

Class constructor

public ReflowControl (Context context, AttributeSet attrs)

Class constructor

Public Methods

public void addReflowLongPressListener (ReflowControl.OnReflowLongPressListener listener)

Adds a listener that will be invoked by ReflowControl.OnReflowLongPressListener.

Components that add a listener should take care to remove it when finished. Other components that take ownership of a view may call clearReflowLongPressListeners() to remove all attached listeners.

Parameters
listener listener to add

public void addReflowOnTapListener (ReflowControl.OnReflowTapListener listener)

Adds a listener that will be invoked by ReflowControl.OnReflowTapListener.

Components that add a listener should take care to remove it when finished. Other components that take ownership of a view may call clearReflowOnTapListeners() to remove all attached listeners.

Parameters
listener listener to add

public void cleanUp ()

Cleans up.

public void clearAdapterCacheAndReset ()

public void clearReflowLongPressListeners ()

Remove all listeners that are notified of any callback from OnReflowLongPressListener.

public void clearReflowOnTapListeners ()

Remove all listeners that are notified of any callback from OnTapListener.

public void enableTurnPageOnTap (boolean enabled)

Enables turn page on tap.

Parameters
enabled True if should turn page on tap
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public int getCurrentPage ()

Gets the current page.

Returns
  • The page number
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean getIsDoNotReflowTextOverImages ()

Gets value to show text over images in reflow mode, default to false.

public boolean getIsHideBackgroundImages ()

Gets value to show background images in reflow mode, default to false.

public boolean getIsHideImagesUnderInvisibleText ()

Gets value to show images under invisible text in reflow mode, default to false.

public boolean getIsHideImagesUnderText ()

Gets value to show images under text in reflow mode, default to false.

public int getOrientation ()

Gets the paging direction

public int getTextSizeInPercent ()

Returns the text size.

Returns
  • The text size ranging from 0 to 100
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean isCustomColorMode ()

Checks whether reflow is in custom color mode.

Returns
  • True if reflow is in custom color mode
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean isDayMode ()

Checks whether reflow is in day mode.

Returns
  • True if reflow is in day mode
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean isInternalLinkClicked ()

Checks whether an internal link is clicked.

Returns
  • True if an internal link is clicked
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean isNightMode ()

Checks whether reflow is in night mode.

Returns
  • True if reflow is in night mode
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean isReady ()

Checks whether the reflow control is ready

Returns
  • True if the reflow control is ready

public boolean isRightToLeftDirection ()

Checks whether right-to-left mode is enabled.

Returns
  • True if right-to-left mode is enabled
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void notifyPagesModified ()

Notifies that pages are modified

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public boolean onInterceptTouchEvent (MotionEvent ev)

public void onReflowPagerLongPress (WebView webView, MotionEvent event)

Called when a long press event happens

Parameters
event The motion event

public void onReflowPagerSingleTapUp (WebView webView, MotionEvent event)

Called when a single tap up event happens

Parameters
event The motion event

public boolean onTouchEvent (MotionEvent ev)

public void removeReflowLongPressListener (ReflowControl.OnReflowLongPressListener listener)

Removes a listener that was previously added via addReflowLongPressListener(OnReflowLongPressListener).

Parameters
listener listener to remove

public void removeReflowOnTapListener (ReflowControl.OnReflowTapListener listener)

Removes a listener that was previously added via addReflowOnTapListener(OnReflowTapListener).

Parameters
listener listener to remove

public void reset ()

Resets the reflow control

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void resetInternalLinkClicked ()

Resets that an internal link is clicked.

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void scrollPageBy (int x, int y)

Scroll the current WebView by x and y.

public void setAnnotStyleProperties (HashMap<Integer, AnnotStyleProperty> annotStyleProperties)

Sets the AnnotStyleProperties that will be used to hide elements of the AnnotStyleDialog

public void setCurrentPage (int pageNum)

Sets the current page.

Parameters
pageNum The page number (starts from 1)
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setCustomColorMode (int backgroundColorMode)

Sets reflow in custom color mode.

Parameters
backgroundColorMode The background color
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setDayMode ()

Sets reflow in day mode.

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setDoNotReflowTextOverImages (boolean doNotReflowTextOverImages)

Sets whether to show text over images in reflow mode, default to false.

public void setEditingEnabled (boolean editingEnabled)

On Nougat and up, it is possible to edit text markups. Sets whether editing text markup is enabled.

public void setHideBackgroundImages (boolean hideBackgroundImages)

Sets whether to show background images in reflow mode, default to false.

public void setHideImagesUnderInvisibleText (boolean hideImagesUnderInvisibleText)

Sets whether to show images under invisible text in reflow mode, default to false.

public void setHideImagesUnderText (boolean hideImagesUnderText)

Sets whether to show images under text in reflow mode, default to false.

public void setImageInReflowEnabled (boolean imageInReflowEnabled)

Sets whether to show images in reflow mode, default to true.

public void setNightMode ()

Sets reflow in night mode.

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setOnPostProcessColorListener (ReflowControl.OnPostProcessColorListener listener)

Sets the post process color listener

Parameters
listener The listener to add
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setOrientation (int orientation)

Sets the paging direction

public void setReflowUrlLoadedListener (ReflowControl.ReflowUrlLoadedListener listener)

Sets a ReflowUrlLoadedListener for ReflowPagerAdapterCallback

Parameters
listener The listener

public void setRightToLeftDirection (boolean isRtlMode)

Sets right-to-left mode.

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setTextSelectionMenuEnabled (boolean textSelectionMenuEnabled)

Disables text selection menu webview (long press)

public void setTextSizeInPercent (int textSizeInPercent)

Sets the text size.

Parameters
textSizeInPercent The text size. The possible values are 5, 10, 25, 50, 75, 100, 125, 150, 200, 40, 800, 1600
Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void setup (PDFDoc pdfDoc, ToolManager toolManager, ReflowControl.OnPostProcessColorListener listener)

Setups the reflow control

Parameters
pdfDoc The PDF doc
toolManager The ToolManager for tracking edits
listener The listener for post processing colors

public void setup (PDFDoc pdfDoc)

Setups the reflow control

Parameters
pdfDoc The PDF doc

public void setup (PDFDoc pdfDoc, ReflowControl.OnPostProcessColorListener listener)

Setups the reflow control

Parameters
pdfDoc The PDF doc
listener The listener for post processing colors

public void updateTextSize ()

Update text size for current page

public void zoomIn ()

Zooms in.

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).

public void zoomOut ()

Zooms out.

Throws
PDFNetException if ReflowControl has not been set up. See setup(PDFDoc) and setup(PDFDoc, OnPostProcessColorListener).