Build 1.0_r1(from source)

android.text.method
Class MetaKeyKeyListener

java.lang.Object
  extended by android.text.method.MetaKeyKeyListener
Direct Known Subclasses:
BaseKeyListener

public abstract class MetaKeyKeyListener
extends Object

This base class encapsulates the behavior for handling the meta keys (caps, fn, sym). Key listener that care about meta state should inherit from it; you should not instantiate this class directly in a client.


Field Summary
static int META_ALT_LOCKED
           
static int META_ALT_ON
           
static int META_CAP_LOCKED
           
static int META_SHIFT_ON
           
static int META_SYM_LOCKED
           
static int META_SYM_ON
           
 
Constructor Summary
MetaKeyKeyListener()
           
 
Method Summary
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 int getMetaState(CharSequence text)
          Gets the state of the meta keys.
static int getMetaState(CharSequence text, int meta)
          Gets the state of a particular meta key.
static boolean isMetaTracker(CharSequence text, Object what)
          Returns true if this object is one that this class would use to keep track of 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.
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.
static void resetMetaState(Spannable text)
          Resets all meta state to inactive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_SHIFT_ON

public static final int META_SHIFT_ON
See Also:
Constant Field Values

META_ALT_ON

public static final int META_ALT_ON
See Also:
Constant Field Values

META_SYM_ON

public static final int META_SYM_ON
See Also:
Constant Field Values

META_CAP_LOCKED

public static final int META_CAP_LOCKED
See Also:
Constant Field Values

META_ALT_LOCKED

public static final int META_ALT_LOCKED
See Also:
Constant Field Values

META_SYM_LOCKED

public static final int META_SYM_LOCKED
See Also:
Constant Field Values
Constructor Detail

MetaKeyKeyListener

public MetaKeyKeyListener()
Method Detail

resetMetaState

public static void resetMetaState(Spannable text)
Resets all meta state to inactive.


getMetaState

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.

getMetaState

public static final int getMetaState(CharSequence text,
                                     int meta)
Gets the state of a particular meta key.

Parameters:
meta - META_SHIFT_ON, META_ALT_ON, or META_SYM_ON
text - the buffer in which the meta key would have been pressed.
Returns:
0 if inactive, 1 if active, 2 if locked.

adjustMetaAfterKeypress

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


isMetaTracker

public static boolean isMetaTracker(CharSequence text,
                                    Object what)
Returns true if this object is one that this class would use to keep track of meta state in the specified text.


resetLockedMeta

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.


onKeyDown

public boolean onKeyDown(View view,
                         Editable content,
                         int keyCode,
                         KeyEvent event)
Handles presses of the meta keys.


onKeyUp

public boolean onKeyUp(View view,
                       Editable content,
                       int keyCode,
                       KeyEvent event)
Handles release of the meta keys.


Build 1.0_r1(from source)

Please submit a feedback, bug or feature