Share via


MetaKeyKeyListener Class

Definition

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.

[Android.Runtime.Register("android/text/method/MetaKeyKeyListener", DoNotGenerateAcw=true)]
public abstract class MetaKeyKeyListener : Java.Lang.Object
[<Android.Runtime.Register("android/text/method/MetaKeyKeyListener", DoNotGenerateAcw=true)>]
type MetaKeyKeyListener = class
    inherit Object
Inheritance
MetaKeyKeyListener
Derived
Attributes

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.

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.

<ul> <li>Methods such as #handleKeyDown(long, int, KeyEvent) and #getMetaState(long) operate on a meta key state bit mask.</li> <li>Methods such as #onKeyDown(View, Editable, int, KeyEvent) and #getMetaState(CharSequence, int) operate on meta key state flags stored as spans in an Editable text buffer. The spans only describe the current meta key state of the text editor; they do not carry any positional information.</li> </ul>

The behavior of this class varies according to the keyboard capabilities described by the KeyCharacterMap of the keyboard device such as the KeyCharacterMap#getModifierBehavior() key modifier behavior.

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 Editable text buffer or in a meta state integer managed by the client. These latched or locked modifiers should be considered to be held <b>in addition to</b> those that the keyboard already reported as being pressed in KeyEvent#getMetaState(). 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 KeyEvent#KEYCODE_CAPS_LOCK or 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:

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); }

Java documentation for android.text.method.MetaKeyKeyListener.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

MetaKeyKeyListener()
MetaKeyKeyListener(IntPtr, JniHandleOwnership)

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

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AdjustMetaAfterKeypress(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).

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).

ClearMetaKeyState(IEditable, MetaKeyStates)

Clears the state of the specified meta key if it is locked.

ClearMetaKeyState(MetaKeyStates, MetaStates)

Clears the state of the specified meta key if it is locked.

ClearMetaKeyState(View, IEditable, MetaKeyStates)

Clears the state of the specified meta key if it is locked.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetMetaState(ICharSequence, KeyEvent)

Gets the state of the meta keys for a specific key event.

GetMetaState(ICharSequence, MetaStates, KeyEvent)

Gets the state of a particular meta key to use with a particular key event.

GetMetaState(ICharSequence, MetaStates)

Gets the state of a particular meta key.

GetMetaState(ICharSequence)

Gets the state of the meta keys.

GetMetaState(MetaKeyStates, MetaStates)

Gets the state of the meta keys.

GetMetaState(MetaKeyStates)

Gets the state of the meta keys.

GetMetaState(String, KeyEvent)

Gets the state of the meta keys for a specific key event.

GetMetaState(String, MetaStates, KeyEvent)

Gets the state of a particular meta key to use with a particular key event.

GetMetaState(String, MetaStates)

Gets the state of a particular meta key.

GetMetaState(String)

Gets the state of the meta keys.

HandleKeyDown(Int64, Keycode, KeyEvent)

Handles presses of the meta keys.

HandleKeyUp(Int64, Keycode, KeyEvent)

Handles release of the meta keys.

IsMetaTracker(ICharSequence, Object)

Returns true if this object is one that this class would use to keep track of any meta state in the specified text.

IsMetaTracker(String, Object)

Returns true if this object is one that this class would use to keep track of any meta state in the specified text.

IsSelectingMetaTracker(ICharSequence, Object)

Returns true if this object is one that this class would use to keep track of the selecting meta state in the specified text.

IsSelectingMetaTracker(String, Object)

Returns true if this object is one that this class would use to keep track of the selecting meta state in the specified text.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnKeyDown(View, IEditable, Keycode, KeyEvent)

Handles presses of the meta keys.

OnKeyUp(View, IEditable, Keycode, KeyEvent)

Handles release of the meta keys.

ResetLockedMeta(Int64)

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

ResetLockedMeta(ISpannable)

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

ResetMetaState(ISpannable)

Resets all meta state to inactive.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to