Android
android.text.method
public class

android.text.method.TextKeyListener

java.lang.Object
android.text.method.MetaKeyKeyListener
android.text.method.BaseKeyListener KeyListener
android.text.method.TextKeyListener SpanWatcher

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

Nested Classes

Summary

Constants inherited from class android.text.method.MetaKeyKeyListener

Public Constructors

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

Public Methods

      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(boolean autotext, TextKeyListener.Capitalize cap)
Returns a new or existing instance with the specified capitalization and correction properties.
      static    TextKeyListener  getInstance()
Returns a new or existing instance with no automatic capitalization or correction.
          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.
      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
Methods inherited from class android.text.method.MetaKeyKeyListener
Methods inherited from class java.lang.Object
Methods inherited from interface android.text.SpanWatcher
Methods inherited from interface android.text.method.KeyListener

Details

Public Constructors

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.

Public Methods

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.

public static TextKeyListener getInstance(boolean autotext, TextKeyListener.Capitalize cap)

Returns a new or existing instance with the specified capitalization and correction properties.

Parameters

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

public static TextKeyListener getInstance()

Returns a new or existing instance with no automatic capitalization or correction.

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

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

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

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.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56