Build 1.0_r1(from source)

android.text.method
Class TextKeyListener

java.lang.Object
  extended by android.text.method.MetaKeyKeyListener
      extended by android.text.method.BaseKeyListener
          extended by android.text.method.TextKeyListener
All Implemented Interfaces:
KeyListener, SpanWatcher

public class TextKeyListener
extends BaseKeyListener
implements SpanWatcher

This is the key listener for typing normal text. It delegates to other key listeners appropriate to the current keyboard and language.


Nested Class Summary
static class TextKeyListener.Capitalize
           
 
Field Summary
(package private) static Object ACTIVE
           
(package private) static int AUTO_CAP
           
(package private) static int AUTO_PERIOD
           
(package private) static int AUTO_TEXT
           
(package private) static Object CAPPED
           
(package private) static Object INHIBIT_REPLACEMENT
           
(package private) static Object LAST_TYPED
           
(package private) static int SHOW_PASSWORD
           
 
Fields inherited from class android.text.method.BaseKeyListener
OLD_SEL_START
 
Fields inherited from class android.text.method.MetaKeyKeyListener
META_ALT_LOCKED, META_ALT_ON, META_CAP_LOCKED, META_SHIFT_ON, META_SYM_LOCKED, META_SYM_ON
 
Constructor Summary
TextKeyListener(TextKeyListener.Capitalize cap, boolean autotext)
          Creates a new TextKeyListener with the specified capitalization and correction properties.
 
Method Summary
static void clear(Editable e)
          Clear all the input state (autotext, autocap, multitap, undo) from the specified Editable, going beyond Editable.clear(), which just clears the text but not the input state.
static TextKeyListener getInstance()
          Returns a new or existing instance with no automatic capitalization or correction.
static TextKeyListener getInstance(boolean autotext, TextKeyListener.Capitalize cap)
          Returns a new or existing instance with the specified capitalization and correction properties.
(package private)  int getPrefs(Context context)
           
 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.
 void onSpanAdded(Spannable s, Object what, int start, int end)
          This method is called to notify you that the specified object has been attached to the specified range of the text.
 void onSpanChanged(Spannable s, Object what, int start, int end, int st, int en)
          This method is called to notify you that the specified object has been relocated from the range ostart…oend to the new range nstart…nend of the text.
 void onSpanRemoved(Spannable s, Object what, int start, int end)
          This method is called to notify you that the specified object has been detached from the specified range of the text.
 void release()
           
static boolean shouldCap(TextKeyListener.Capitalize cap, CharSequence cs, int off)
          Returns whether it makes sense to automatically capitalize at the specified position in the specified text, with the specified rules.
 
Methods inherited from class android.text.method.BaseKeyListener
backspace
 
Methods inherited from class android.text.method.MetaKeyKeyListener
adjustMetaAfterKeypress, getMetaState, getMetaState, isMetaTracker, resetLockedMeta, resetMetaState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVE

static final Object ACTIVE

CAPPED

static final Object CAPPED

INHIBIT_REPLACEMENT

static final Object INHIBIT_REPLACEMENT

LAST_TYPED

static final Object LAST_TYPED

AUTO_CAP

static final int AUTO_CAP
See Also:
Constant Field Values

AUTO_TEXT

static final int AUTO_TEXT
See Also:
Constant Field Values

AUTO_PERIOD

static final int AUTO_PERIOD
See Also:
Constant Field Values

SHOW_PASSWORD

static final int SHOW_PASSWORD
See Also:
Constant Field Values
Constructor Detail

TextKeyListener

public TextKeyListener(TextKeyListener.Capitalize cap,
                       boolean autotext)
Creates a new TextKeyListener with the specified capitalization and correction properties.

Parameters:
cap - when, if ever, to automatically capitalize.
autotext - whether to automatically do spelling corrections.
Method Detail

getInstance

public static TextKeyListener getInstance(boolean autotext,
                                          TextKeyListener.Capitalize cap)
Returns a new or existing instance with the specified capitalization and correction properties.

Parameters:
cap - when, if ever, to automatically capitalize.
autotext - whether to automatically do spelling corrections.

getInstance

public static TextKeyListener getInstance()
Returns a new or existing instance with no automatic capitalization or correction.


shouldCap

public static boolean shouldCap(TextKeyListener.Capitalize cap,
                                CharSequence cs,
                                int off)
Returns whether it makes sense to automatically capitalize at the specified position in the specified text, with the specified rules.

Parameters:
cap - the capitalization rules to consider.
cs - the text in which an insertion is being made.
off - the offset into that text where the insertion is being made.
Returns:
whether the character being inserted should be capitalized.

onKeyDown

public boolean onKeyDown(View view,
                         Editable content,
                         int keyCode,
                         KeyEvent event)
Description copied from class: MetaKeyKeyListener
Handles presses of the meta keys.

Specified by:
onKeyDown in interface KeyListener
Overrides:
onKeyDown in class BaseKeyListener

onKeyUp

public boolean onKeyUp(View view,
                       Editable content,
                       int keyCode,
                       KeyEvent event)
Description copied from class: MetaKeyKeyListener
Handles release of the meta keys.

Specified by:
onKeyUp in interface KeyListener
Overrides:
onKeyUp in class MetaKeyKeyListener

clear

public static void clear(Editable e)
Clear all the input state (autotext, autocap, multitap, undo) from the specified Editable, going beyond Editable.clear(), which just clears the text but not the input state.

Parameters:
e - the buffer whose text and state are to be cleared.

onSpanAdded

public void onSpanAdded(Spannable s,
                        Object what,
                        int start,
                        int end)
Description copied from interface: SpanWatcher
This method is called to notify you that the specified object has been attached to the specified range of the text.

Specified by:
onSpanAdded in interface SpanWatcher

onSpanRemoved

public void onSpanRemoved(Spannable s,
                          Object what,
                          int start,
                          int end)
Description copied from interface: SpanWatcher
This method is called to notify you that the specified object has been detached from the specified range of the text.

Specified by:
onSpanRemoved in interface SpanWatcher

onSpanChanged

public void onSpanChanged(Spannable s,
                          Object what,
                          int start,
                          int end,
                          int st,
                          int en)
Description copied from interface: SpanWatcher
This method is called to notify you that the specified object has been relocated from the range ostart…oend to the new range nstart…nend of the text.

Specified by:
onSpanChanged in interface SpanWatcher

release

public void release()

getPrefs

int getPrefs(Context context)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature