Lines Matching refs:text

20 import android.text.Editable;
21 import android.text.SpannableString;
22 import android.text.Spanned;
23 import android.text.TextUtils;
24 import android.text.method.QwertyKeyListener;
28 * An editable text view, extending {@link AutoCompleteTextView}, that
29 * can show completion suggestions for the substring of the text where
35 * <p>The following code snippet shows how to create a text view which suggests
81 * range of the text where the user is typing.
94 protected void performFiltering(CharSequence text, int keyCode) {
97 int start = mTokenizer.findTokenStart(text, end);
99 performFiltering(text, start, end, keyCode);
111 * Instead of filtering whenever the total length of the text
119 Editable text = getText();
126 int start = mTokenizer.findTokenStart(text, end);
136 * Instead of validating the entire text, this subclass method validates
137 * each token of the text individually. Empty tokens are removed.
167 * pattern is the specified range of text from the edit box. Subclasses may
169 * instance a smaller substring of <code>text</code>.</p>
171 protected void performFiltering(CharSequence text, int start, int end,
173 getFilter().filter(text.subSequence(start, end), this);
177 * <p>Performs the text completion by replacing the range from
179 * the result of passing <code>text</code> through
187 * @param text the selected suggestion in the drop down list
190 protected void replaceText(CharSequence text) {
200 editable.replace(start, end, mTokenizer.terminateToken(text));
211 * <code>cursor</code> within <code>text</code>.
213 public int findTokenStart(CharSequence text, int cursor);
217 * that begins at offset <code>cursor</code> within <code>text</code>.
219 public int findTokenEnd(CharSequence text, int cursor);
222 * Returns <code>text</code>, modified, if necessary, to ensure that
225 public CharSequence terminateToken(CharSequence text);
233 public int findTokenStart(CharSequence text, int cursor) {
236 while (i > 0 && text.charAt(i - 1) != ',') {
239 while (i < cursor && text.charAt(i) == ' ') {
246 public int findTokenEnd(CharSequence text, int cursor) {
248 int len = text.length();
251 if (text.charAt(i) == ',') {
261 public CharSequence terminateToken(CharSequence text) {
262 int i = text.length();
264 while (i > 0 && text.charAt(i - 1) == ' ') {
268 if (i > 0 && text.charAt(i - 1) == ',') {
269 return text;
271 if (text instanceof Spanned) {
272 SpannableString sp = new SpannableString(text + ", ");
273 TextUtils.copySpansFrom((Spanned) text, 0, text.length(),
277 return text + ", ";