Package icyllis.modernui.text.method

# Class BaseMovementMethod

java.lang.Object
icyllis.modernui.text.method.BaseMovementMethod

All Implemented Interfaces:
  `MovementMethod`

Direct Known Subclasses:
  `ArrowKeyMovementMethod`, `ScrollingMovementMethod`

@ParametersAreNonnullByDefault public abstract class BaseMovementMethod extends Object implements MovementMethod
Base classes for movement methods.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `BaseMovementMethod()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `bottom(TextView widget, Spannable buffer)`
  Performs a bottom movement action.
  `boolean`
  `canSelectArbitrarily()`
  Returns true if this movement method allows arbitrary selection of any text; false if it has no selection (like a movement method that only scrolls) or a constrained selection (for example limited to links.
  `protected boolean`
  `down(TextView widget, Spannable buffer)`
  Performs a down movement action.
  `protected boolean`
  `end(TextView widget, Spannable buffer)`
  Performs an end movement action.
  `protected boolean`
  `handleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMods)`
  Performs a movement key action.
  `protected boolean`
  `home(TextView widget, Spannable buffer)`
  Performs a home movement action.
  `void`
  `initialize(TextView widget, Spannable text)`
  `protected boolean`
  `left(TextView widget, Spannable buffer)`
  Performs a left movement action.
  `protected boolean`
  `leftWord(TextView widget, Spannable buffer)`
  `protected boolean`
  `lineEnd(TextView widget, Spannable buffer)`
  Performs a line-end movement action.
  `protected boolean`
  `lineStart(TextView widget, Spannable buffer)`
  Performs a line-start movement action.
  `boolean`
  `onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event)`
  `boolean`
  `onKeyDown(TextView widget, Spannable text, int keyCode, KeyEvent event)`
  `boolean`
  `onKeyUp(TextView widget, Spannable text, int keyCode, KeyEvent event)`
  `void`
  `onTakeFocus(TextView widget, Spannable text, int direction)`
  `boolean`
  `onTouchEvent(TextView widget, Spannable text, MotionEvent event)`
  `protected boolean`
  `pageDown(TextView widget, Spannable buffer)`
  Performs a page-down movement action.
  `protected boolean`
  `pageUp(TextView widget, Spannable buffer)`
  Performs a page-up movement action.
  `protected boolean`
  `right(TextView widget, Spannable buffer)`
  Performs a right movement action.
  `protected boolean`
  `rightWord(TextView widget, Spannable buffer)`
  `protected boolean`
  `scrollBottom(TextView widget)`
  Performs a scroll to bottom action.
  `protected boolean`
  `scrollDown(TextView widget, int amount)`
  Performs a scroll down action.
  `protected boolean`
  `scrollLeft(TextView widget, int amount)`
  Performs a scroll left action.
  `protected boolean`
  `scrollLineEnd(TextView widget)`
  Performs a scroll to line end action.
  `protected boolean`
  `scrollLineStart(TextView widget)`
  Performs a scroll to line start action.
  `protected boolean`
  `scrollPageDown(TextView widget)`
  Performs a scroll page up action.
  `protected boolean`
  `scrollPageUp(TextView widget)`
  Performs a scroll page up action.
  `protected boolean`
  `scrollRight(TextView widget, int amount)`
  Performs a scroll right action.
  `protected boolean`
  `scrollTop(TextView widget)`
  Performs a scroll to top action.
  `protected boolean`
  `scrollUp(TextView widget, int amount)`
  Performs a scroll up action.
  `protected boolean`
  `top(TextView widget, Spannable buffer)`
  Performs a top movement action.
  `protected boolean`
  `up(TextView widget, Spannable buffer)`
  Performs an up movement action.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BaseMovementMethod

    protected BaseMovementMethod()

- ## Method Details

  - ### canSelectArbitrarily

    public boolean canSelectArbitrarily()
    Description copied from interface: `MovementMethod`
    Returns true if this movement method allows arbitrary selection of any text; false if it has no selection (like a movement method that only scrolls) or a constrained selection (for example limited to links. The "Select All" menu item is disabled if arbitrary selection is not allowed.
    Specified by:
      `canSelectArbitrarily` in interface `MovementMethod`

  - ### initialize

    public void initialize(TextView widget, Spannable text)
    Specified by:
      `initialize` in interface `MovementMethod`

  - ### onKeyDown

    public boolean onKeyDown(TextView widget, Spannable text, int keyCode, KeyEvent event)
    Specified by:
      `onKeyDown` in interface `MovementMethod`

  - ### onKeyUp

    public boolean onKeyUp(TextView widget, Spannable text, int keyCode, KeyEvent event)
    Specified by:
      `onKeyUp` in interface `MovementMethod`

  - ### onTakeFocus

    public void onTakeFocus(TextView widget, Spannable text, int direction)
    Specified by:
      `onTakeFocus` in interface `MovementMethod`

  - ### onTouchEvent

    public boolean onTouchEvent(TextView widget, Spannable text, MotionEvent event)
    Specified by:
      `onTouchEvent` in interface `MovementMethod`

  - ### onGenericMotionEvent

    public boolean onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event)
    Specified by:
      `onGenericMotionEvent` in interface `MovementMethod`

  - ### handleMovementKey

    protected boolean handleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMods)
    Performs a movement key action.

    The default implementation decodes the key down and invokes movement actions such as `down(icyllis.modernui.widget.TextView, icyllis.modernui.text.Spannable)` and `up(icyllis.modernui.widget.TextView, icyllis.modernui.text.Spannable)`.

    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
      `keyCode` - The key code.
      `movementMods` - The keyboard meta states used for movement.
    Returns:
      True if the event was handled.

  - ### left

    protected boolean left(TextView widget, Spannable buffer)
    Performs a left movement action. Moves the cursor or scrolls left by one character.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### right

    protected boolean right(TextView widget, Spannable buffer)
    Performs a right movement action. Moves the cursor or scrolls right by one character.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### up

    protected boolean up(TextView widget, Spannable buffer)
    Performs an up movement action. Moves the cursor or scrolls up by one line.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### down

    protected boolean down(TextView widget, Spannable buffer)
    Performs a down movement action. Moves the cursor or scrolls down by one line.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### pageUp

    protected boolean pageUp(TextView widget, Spannable buffer)
    Performs a page-up movement action. Moves the cursor or scrolls up by one page.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### pageDown

    protected boolean pageDown(TextView widget, Spannable buffer)
    Performs a page-down movement action. Moves the cursor or scrolls down by one page.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### top

    protected boolean top(TextView widget, Spannable buffer)
    Performs a top movement action. Moves the cursor or scrolls to the top of the buffer.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### bottom

    protected boolean bottom(TextView widget, Spannable buffer)
    Performs a bottom movement action. Moves the cursor or scrolls to the bottom of the buffer.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### lineStart

    protected boolean lineStart(TextView widget, Spannable buffer)
    Performs a line-start movement action. Moves the cursor or scrolls to the start of the line.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### lineEnd

    protected boolean lineEnd(TextView widget, Spannable buffer)
    Performs a line-end movement action. Moves the cursor or scrolls to the end of the line.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### leftWord

    protected boolean leftWord(TextView widget, Spannable buffer)

  - ### rightWord

    protected boolean rightWord(TextView widget, Spannable buffer)

  - ### home

    protected boolean home(TextView widget, Spannable buffer)
    Performs a home movement action. Moves the cursor or scrolls to the start of the line or to the top of the document depending on whether the insertion point is being moved or the document is being scrolled.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### end

    protected boolean end(TextView widget, Spannable buffer)
    Performs an end movement action. Moves the cursor or scrolls to the start of the line or to the top of the document depending on whether the insertion point is being moved or the document is being scrolled.
    Parameters:
      `widget` - The text view.
      `buffer` - The text buffer.
    Returns:
      True if the event was handled.

  - ### scrollLeft

    protected boolean scrollLeft(TextView widget, int amount)
    Performs a scroll left action. Scrolls left by the specified number of characters.
    Parameters:
      `widget` - The text view.
      `amount` - The number of characters to scroll by. Must be at least 1.
    Returns:
      True if the event was handled.

  - ### scrollRight

    protected boolean scrollRight(TextView widget, int amount)
    Performs a scroll right action. Scrolls right by the specified number of characters.
    Parameters:
      `widget` - The text view.
      `amount` - The number of characters to scroll by. Must be at least 1.
    Returns:
      True if the event was handled.

  - ### scrollUp

    protected boolean scrollUp(TextView widget, int amount)
    Performs a scroll up action. Scrolls up by the specified number of lines.
    Parameters:
      `widget` - The text view.
      `amount` - The number of lines to scroll by. Must be at least 1.
    Returns:
      True if the event was handled.

  - ### scrollDown

    protected boolean scrollDown(TextView widget, int amount)
    Performs a scroll down action. Scrolls down by the specified number of lines.
    Parameters:
      `widget` - The text view.
      `amount` - The number of lines to scroll by. Must be at least 1.
    Returns:
      True if the event was handled.

  - ### scrollPageUp

    protected boolean scrollPageUp(TextView widget)
    Performs a scroll page up action. Scrolls up by one page.
    Parameters:
      `widget` - The text view.
    Returns:
      True if the event was handled.

  - ### scrollPageDown

    protected boolean scrollPageDown(TextView widget)
    Performs a scroll page up action. Scrolls down by one page.
    Parameters:
      `widget` - The text view.
    Returns:
      True if the event was handled.

  - ### scrollTop

    protected boolean scrollTop(TextView widget)
    Performs a scroll to top action. Scrolls to the top of the document.
    Parameters:
      `widget` - The text view.
    Returns:
      True if the event was handled.

  - ### scrollBottom

    protected boolean scrollBottom(TextView widget)
    Performs a scroll to bottom action. Scrolls to the bottom of the document.
    Parameters:
      `widget` - The text view.
    Returns:
      True if the event was handled.

  - ### scrollLineStart

    protected boolean scrollLineStart(TextView widget)
    Performs a scroll to line start action. Scrolls to the start of the line.
    Parameters:
      `widget` - The text view.
    Returns:
      True if the event was handled.

  - ### scrollLineEnd

    protected boolean scrollLineEnd(TextView widget)
    Performs a scroll to line end action. Scrolls to the end of the line.
    Parameters:
      `widget` - The text view.
    Returns:
      True if the event was handled.