Android Guides | Samples

Android.Text.Method.MetaKeyKeyListener Class

This base class encapsulates the behavior for tracking the state of meta keys such as SHIFT, ALT and SYM as well as the pseudo-meta state of selecting text.

See Also: MetaKeyKeyListener

Syntax

[Android.Runtime.Register("android/text/method/MetaKeyKeyListener", DoNotGenerateAcw=true)]
public abstract class MetaKeyKeyListener : Object

Remarks

This base class encapsulates the behavior for tracking the state of meta keys such as SHIFT, ALT and SYM as well as the pseudo-meta state of selecting text.

private char getUnicodeChar(TextKeyListener listener, KeyEvent event, Editable textBuffer) { // Use the combined meta states from the event and the key listener. int metaState = event.getMetaState() | listener.getMetaState(textBuffer); return event.getUnicodeChar(metaState); }

Key listeners that care about meta state should inherit from this class; you should not instantiate this class directly in a client.

This class provides two mechanisms for tracking meta state that can be used together or independently.

The behavior of this class varies according to the keyboard capabilities described by the KeyCharacterMap of the keyboard device such as the KeyCharacterMap.ModifierBehavior.

MetaKeyKeyListener implements chorded and toggled key modifiers. When key modifiers are toggled into a latched or locked state, the state of the modifier is stored in the IEditable text buffer or in a meta state integer managed by the client. These latched or locked modifiers should be considered to be held in addition to those that the keyboard already reported as being pressed in KeyEvent.MetaState. In other words, the MetaKeyKeyListener augments the meta state provided by the keyboard; it does not replace it. This distinction is important to ensure that meta keys not handled by MetaKeyKeyListener such as Android.Views.KeyEvent.KEYCODE_CAPS_LOCK or Android.Views.KeyEvent.KEYCODE_NUM_LOCK are taken into consideration.

To ensure correct meta key behavior, the following pattern should be used when mapping key codes to characters:

[Android Documentation]

Requirements

Namespace: Android.Text.Method
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Text.Method.MetaKeyKeyListener are listed below.

See Also: Object

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

static
AdjustMetaAfterKeypress(ISpannable)
Call this method after you handle a keypress so that the meta state will be reset to unshifted (if it is not still down) or primed to be reset to unshifted (once it is released).
static
AdjustMetaAfterKeypress(Int64) : Int64
Call this method after you handle a keypress so that the meta state will be reset to unshifted (if it is not still down) or primed to be reset to unshifted (once it is released).
static
ClearMetaKeyState(IEditable, MetaKeyStates)
ClearMetaKeyState(MetaKeyStates, MetaStates) : Int64
ClearMetaKeyState(View, IEditable, MetaKeyStates)
static
GetMetaState(MetaKeyStates) : Int32
Gets the state of a particular meta key to use with a particular key event.
static
GetMetaState(ICharSequence) : Int32
Gets the state of the meta keys.
static
GetMetaState(String) : Int32
static
GetMetaState(MetaKeyStates, MetaStates) : Int32
static
GetMetaState(ICharSequence, MetaStates) : Int32
Gets the state of a particular meta key.
static
GetMetaState(ICharSequence, KeyEvent) : Int32
Gets the state of the meta keys for a specific key event.
static
GetMetaState(String, MetaStates) : Int32
static
GetMetaState(String, KeyEvent) : Int32
static
GetMetaState(ICharSequence, MetaStates, KeyEvent) : Int32
Gets the state of a particular meta key to use with a particular key event.
static
GetMetaState(String, MetaStates, KeyEvent) : Int32
static
HandleKeyDown(Int64, Keycode, KeyEvent) : Int64
Handles presses of the meta keys.
static
HandleKeyUp(Int64, Keycode, KeyEvent) : Int64
Handles release of the meta keys.
static
IsMetaTracker(ICharSequence, Object) : Boolean
Returns true if this object is one that this class would use to keep track of any meta state in the specified text.
static
IsMetaTracker(String, Object) : Boolean
static
IsSelectingMetaTracker(ICharSequence, Object) : Boolean
Returns true if this object is one that this class would use to keep track of the selecting meta state in the specified text.
static
IsSelectingMetaTracker(String, Object) : Boolean
OnKeyDown(View, IEditable, Keycode, KeyEvent) : Boolean
Handles presses of the meta keys.
OnKeyUp(View, IEditable, Keycode, KeyEvent) : Boolean
Handles release of the meta keys.
static
ResetLockedMeta(Int64) : Int64
Call this if you are a method that ignores the locked meta state (arrow keys, for example) and you handle a key.
static
ResetMetaState(ISpannable)
Resets all meta state to inactive.

Protected Methods

static
ResetLockedMeta(ISpannable)
Call this if you are a method that ignores the locked meta state (arrow keys, for example) and you handle a key.