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
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Performs a bottom movement action.boolean
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
Performs a down movement action.protected boolean
Performs an end movement action.protected boolean
handleMovementKey
(TextView widget, Spannable buffer, int keyCode, int movementMods) Performs a movement key action.protected boolean
Performs a home movement action.void
initialize
(TextView widget, Spannable text) protected boolean
Performs a left movement action.protected boolean
protected boolean
Performs a line-end movement action.protected boolean
Performs a line-start movement action.boolean
onGenericMotionEvent
(TextView widget, Spannable text, MotionEvent event) boolean
boolean
void
onTakeFocus
(TextView widget, Spannable text, int direction) boolean
onTouchEvent
(TextView widget, Spannable text, MotionEvent event) protected boolean
Performs a page-down movement action.protected boolean
Performs a page-up movement action.protected boolean
Performs a right movement action.protected boolean
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
Performs a scroll to top action.protected boolean
Performs a scroll up action.protected boolean
Performs a top movement action.protected boolean
Performs an up movement action.
-
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 interfaceMovementMethod
-
initialize
- Specified by:
initialize
in interfaceMovementMethod
-
onKeyDown
- Specified by:
onKeyDown
in interfaceMovementMethod
-
onKeyUp
- Specified by:
onKeyUp
in interfaceMovementMethod
-
onTakeFocus
- Specified by:
onTakeFocus
in interfaceMovementMethod
-
onTouchEvent
- Specified by:
onTouchEvent
in interfaceMovementMethod
-
onGenericMotionEvent
- Specified by:
onGenericMotionEvent
in interfaceMovementMethod
-
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)
andup(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
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
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
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
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
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
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
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
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
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
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
-
rightWord
-
home
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
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
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
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
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
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
Performs a scroll page up action. Scrolls up by one page.- Parameters:
widget
- The text view.- Returns:
- True if the event was handled.
-
scrollPageDown
Performs a scroll page up action. Scrolls down by one page.- Parameters:
widget
- The text view.- Returns:
- True if the event was handled.
-
scrollTop
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
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
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
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.
-