@Test public void terminateToken() throws Exception { MatcherAssert.assertThat(tokenizer.terminateToken(""), is("")); MatcherAssert.assertThat(tokenizer.terminateToken(" "), is(" ")); MatcherAssert.assertThat(tokenizer.terminateToken("test "), is("test ")); MatcherAssert.assertThat(tokenizer.terminateToken("test"), is("test ")); }
@Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); char separator = getDefaultSeparator(); if (i == 0 || (i > 0 && text.charAt(i - 1) == separator)) { return text; } if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + String.valueOf(separator)); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + String.valueOf(separator); } }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); char separator = getDefaultSeparator(); if (i == 0 || (i > 0 && text.charAt(i - 1) == separator)) { return text; } if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + String.valueOf(separator)); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + String.valueOf(separator); } } }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); char separator = getDefaultSeparator(); if (i == 0 || (i > 0 && text.charAt(i - 1) == separator)) { return text; } if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + String.valueOf(separator)); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + String.valueOf(separator); } } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); char separator = getDefaultSeparator(); if (i == 0 || (i > 0 && text.charAt(i - 1) == separator)) { return text; } if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + String.valueOf(separator)); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + String.valueOf(separator); } } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); @Override int findTokenStart(CharSequence text, int cursor); @Override int findTokenEnd(CharSequence text, int cursor); @Override CharSequence terminateToken(CharSequence text); }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); char separator = getDefaultSeparator(); if (i == 0 || (i > 0 && text.charAt(i - 1) == separator)) { return text; } if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + String.valueOf(separator)); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + String.valueOf(separator); } } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); @Override int findTokenStart(CharSequence text, int cursor); @Override int findTokenEnd(CharSequence text, int cursor); @Override CharSequence terminateToken(CharSequence text);  }