QwertyKeyListener
open class QwertyKeyListener : BaseKeyListener
| kotlin.Any | |||
| ↳ | android.text.method.MetaKeyKeyListener | ||
| ↳ | android.text.method.BaseKeyListener | ||
| ↳ | android.text.method.QwertyKeyListener | ||
This is the standard key listener for alphabetic input on qwerty keyboards. You should generally not need to instantiate this yourself; TextKeyListener will do it for you.
As for all implementations ofKeyListener, this class is only concerned with hardware keyboards. Software input methods have no obligation to trigger the methods in this class.
Summary
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
QwertyKeyListener(cap: TextKeyListener.Capitalize!, autoText: Boolean) |
|
| Public methods | |
|---|---|
| open Int |
Return the type of text that this key listener is manipulating, as per |
| open static QwertyKeyListener! |
getInstance(autoText: Boolean, cap: TextKeyListener.Capitalize!)Returns a new or existing instance with the specified capitalization and correction properties. |
| open static QwertyKeyListener! |
Gets an instance of the listener suitable for use with full keyboards. |
| open static Unit |
markAsReplaced(content: Spannable!, start: Int, end: Int, original: String!)Marks the specified region of |
| open Boolean |
Handles presses of the meta keys. |
| Inherited functions | |
|---|---|
Public constructors
QwertyKeyListener
QwertyKeyListener(
cap: TextKeyListener.Capitalize!,
autoText: Boolean)
Public methods
getInputType
open fun getInputType(): Int
Return the type of text that this key listener is manipulating, as per android.text.InputType. This is used to determine the mode of the soft keyboard that is shown for the editor.
If you return android.text.InputType#TYPE_NULL then no soft keyboard will provided. In other words, you must be providing your own key pad for on-screen input and the key listener will be used to handle input from a hard keyboard.
If you return any other value, a soft input method will be created when the user puts focus in the editor, which will provide a keypad and also consume hard key events. This means that the key listener will generally not be used, instead the soft input method will take care of managing key input as per the content type returned here.
getInstance
open static fun getInstance(
autoText: Boolean,
cap: TextKeyListener.Capitalize!
): QwertyKeyListener!
Returns a new or existing instance with the specified capitalization and correction properties.
getInstanceForFullKeyboard
open static fun getInstanceForFullKeyboard(): QwertyKeyListener!
Gets an instance of the listener suitable for use with full keyboards. Disables auto-capitalization, auto-text and long-press initiated on-screen character pickers.
markAsReplaced
open static fun markAsReplaced(
content: Spannable!,
start: Int,
end: Int,
original: String!
): Unit
Marks the specified region of content as having contained original prior to AutoText replacement. Call this method when you have done or are about to do an AutoText-style replacement on a region of text and want to let the same mechanism (the user pressing DEL immediately after the change) undo the replacement.
| Parameters | |
|---|---|
content |
Spannable!: the Editable text where the replacement was made |
start |
Int: the start of the replaced region |
end |
Int: the end of the replaced region; the location of the cursor |
original |
String!: the text to be restored if the user presses DEL |
onKeyDown
open fun onKeyDown(
view: View!,
content: Editable!,
keyCode: Int,
event: KeyEvent!
): Boolean
Handles presses of the meta keys.