Package icyllis.modernui.text.method
Class TextKeyListener
java.lang.Object
icyllis.modernui.text.method.TextKeyListener
Provides methods for handling text additions and deletions in a
TextView.-
Method Summary
Modifier and TypeMethodDescriptionbooleanPerforms the action that happens when you press theKeyEvent.KEY_BACKSPACEkey in aTextView.booleanforwardDelete(TextView view, Editable content, KeyEvent event) Performs the action that happens when you press theKeyEvent.KEY_DELETEkey in aTextView.static TextKeyListenerstatic intgetMetaState(CharSequence text, int meta) Gets the state of a particular meta key.static booleanisMetaTracker(Object what) Returns true if this object is one that this class would use to keep track of any meta state in the specified text.booleanIf the key listener wants to handle this key, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.booleanIf the key listener wants to handle this key release, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.static voidresetMetaState(Spannable text) Resets all meta state to inactive.
-
Method Details
-
getInstance
-
resetMetaState
Resets all meta state to inactive. -
getMetaState
Gets the state of a particular meta key.- Parameters:
text- the buffer in which the meta key would have been pressed.meta- META_SHIFT_ON, META_ALT_ON, META_SYM_ON- Returns:
- 0 if inactive, 1 if active, 2 if locked.
-
isMetaTracker
Returns true if this object is one that this class would use to keep track of any meta state in the specified text. -
onKeyDown
If the key listener wants to handle this key, return true, otherwise return false and the caller (i.e. the widget host) will handle the key. -
onKeyUp
If the key listener wants to handle this key release, return true, otherwise return false and the caller (i.e. the widget host) will handle the key. -
backspace
Performs the action that happens when you press theKeyEvent.KEY_BACKSPACEkey in aTextView. If there is a selection, deletes the selection; otherwise, deletes the character before the cursor, if any; ALT+DEL deletes everything on the line the cursor is on.- Returns:
- true if anything was deleted; false otherwise.
-
forwardDelete
Performs the action that happens when you press theKeyEvent.KEY_DELETEkey in aTextView. If there is a selection, deletes the selection; otherwise, deletes the character before the cursor, if any; ALT+FORWARD_DEL deletes everything on the line the cursor is on.- Returns:
- true if anything was deleted; false otherwise.
-