public abstract class

MetaKeyKeyListener

extends Object
java.lang.Object
   ↳ android.text.method.MetaKeyKeyListener
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This base class encapsulates the behavior for handling the meta keys (shift and alt) and the pseudo-meta state of selecting text. Key listeners that care about meta state should inherit from it; you should not instantiate this class directly in a client.

Summary

Constants
int META_ALT_LOCKED
int META_ALT_ON
int META_CAP_LOCKED
int META_SHIFT_ON
int META_SYM_LOCKED
int META_SYM_ON
Public Constructors
MetaKeyKeyListener()
Public Methods
static void adjustMetaAfterKeypress(Spannable content)
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 long adjustMetaAfterKeypress(long state)
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).
void clearMetaKeyState(View view, Editable content, int states)
long clearMetaKeyState(long state, int which)
static void clearMetaKeyState(Editable content, int states)
final static int getMetaState(long state)
Gets the state of the meta keys.
final static int getMetaState(CharSequence text)
Gets the state of the meta keys.
final static int getMetaState(CharSequence text, int meta)
Gets the state of a particular meta key.
final static int getMetaState(long state, int meta)
Gets the state of a particular meta key.
static long handleKeyDown(long state, int keyCode, KeyEvent event)
Handles presses of the meta keys.
static long handleKeyUp(long state, int keyCode, KeyEvent event)
Handles release of the meta keys.
static boolean isMetaTracker(CharSequence text, 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.
static boolean isSelectingMetaTracker(CharSequence text, Object what)
Returns true if this object is one that this class would use to keep track of the selecting meta state in the specified text.
boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event)
Handles presses of the meta keys.
boolean onKeyUp(View view, Editable content, int keyCode, KeyEvent event)
Handles release of the meta keys.
static long resetLockedMeta(long state)
Call this if you are a method that ignores the locked meta state (arrow keys, for example) and you handle a key.
static void resetMetaState(Spannable text)
Resets all meta state to inactive.
Protected Methods
static void resetLockedMeta(Spannable content)
Call this if you are a method that ignores the locked meta state (arrow keys, for example) and you handle a key.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int META_ALT_LOCKED

Constant Value: 512 (0x00000200)

public static final int META_ALT_ON

Constant Value: 2 (0x00000002)

public static final int META_CAP_LOCKED

Constant Value: 256 (0x00000100)

public static final int META_SHIFT_ON

Constant Value: 1 (0x00000001)

public static final int META_SYM_LOCKED

Constant Value: 1024 (0x00000400)

public static final int META_SYM_ON

Constant Value: 4 (0x00000004)

Public Constructors

public MetaKeyKeyListener ()

Public Methods

public static void adjustMetaAfterKeypress (Spannable content)

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

public static long adjustMetaAfterKeypress (long state)

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). Takes the current state, returns the new state.

public void clearMetaKeyState (View view, Editable content, int states)

public long clearMetaKeyState (long state, int which)

public static void clearMetaKeyState (Editable content, int states)

public static final int getMetaState (long state)

Gets the state of the meta keys.

Parameters
state the current meta state bits.
Returns
  • an integer in which each bit set to one represents a pressed or locked meta key.

public static final int getMetaState (CharSequence text)

Gets the state of the meta keys.

Parameters
text the buffer in which the meta key would have been pressed.
Returns
  • an integer in which each bit set to one represents a pressed or locked meta key.

public static final int getMetaState (CharSequence text, int meta)

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, or META_SELECTING
Returns
  • 0 if inactive, 1 if active, 2 if locked.

public static final int getMetaState (long state, int meta)

Gets the state of a particular meta key.

Parameters
state the current state bits.
meta META_SHIFT_ON, META_ALT_ON, or META_SYM_ON
Returns
  • 0 if inactive, 1 if active, 2 if locked.

public static long handleKeyDown (long state, int keyCode, KeyEvent event)

Handles presses of the meta keys.

public static long handleKeyUp (long state, int keyCode, KeyEvent event)

Handles release of the meta keys.

public static boolean isMetaTracker (CharSequence text, 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.

public static boolean isSelectingMetaTracker (CharSequence text, Object what)

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

public boolean onKeyDown (View view, Editable content, int keyCode, KeyEvent event)

Handles presses of the meta keys.

public boolean onKeyUp (View view, Editable content, int keyCode, KeyEvent event)

Handles release of the meta keys.

public static long resetLockedMeta (long state)

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

public static void resetMetaState (Spannable text)

Resets all meta state to inactive.

Protected Methods

protected static void resetLockedMeta (Spannable content)

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