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 -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanPerforms a bottom movement action.booleanReturns 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 booleanPerforms a down movement action.protected booleanPerforms an end movement action.protected booleanhandleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMods) Performs a movement key action.protected booleanPerforms a home movement action.voidinitialize(TextView widget, Spannable text) protected booleanPerforms a left movement action.protected booleanprotected booleanPerforms a line-end movement action.protected booleanPerforms a line-start movement action.booleanonGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) booleanbooleanvoidonTakeFocus(TextView widget, Spannable text, int direction) booleanonTouchEvent(TextView widget, Spannable text, MotionEvent event) protected booleanPerforms a page-down movement action.protected booleanPerforms a page-up movement action.protected booleanPerforms a right movement action.protected booleanprotected booleanscrollBottom(TextView widget) Performs a scroll to bottom action.protected booleanscrollDown(TextView widget, int amount) Performs a scroll down action.protected booleanscrollLeft(TextView widget, int amount) Performs a scroll left action.protected booleanscrollLineEnd(TextView widget) Performs a scroll to line end action.protected booleanscrollLineStart(TextView widget) Performs a scroll to line start action.protected booleanscrollPageDown(TextView widget) Performs a scroll page up action.protected booleanscrollPageUp(TextView widget) Performs a scroll page up action.protected booleanscrollRight(TextView widget, int amount) Performs a scroll right action.protected booleanPerforms a scroll to top action.protected booleanPerforms a scroll up action.protected booleanPerforms a top movement action.protected booleanPerforms an up movement action.
-
Constructor Details
-
BaseMovementMethod
protected BaseMovementMethod()
-
-
Method Details
-
canSelectArbitrarily
public boolean canSelectArbitrarily()Description copied from interface:MovementMethodReturns 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:
canSelectArbitrarilyin interfaceMovementMethod
-
initialize
- Specified by:
initializein interfaceMovementMethod
-
onKeyDown
- Specified by:
onKeyDownin interfaceMovementMethod
-
onKeyUp
- Specified by:
onKeyUpin interfaceMovementMethod
-
onTakeFocus
- Specified by:
onTakeFocusin interfaceMovementMethod
-
onTouchEvent
- Specified by:
onTouchEventin interfaceMovementMethod
-
onGenericMotionEvent
- Specified by:
onGenericMotionEventin 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.
-