@Test public void findTokenStart_multiple() throws Exception { assertThat(tokenizer.findTokenStart(" @:", 3), is(1)); assertThat(tokenizer.findTokenStart(" :@", 3), is(1)); assertThat(tokenizer.findTokenStart(" :test1@test2", 3), is(1)); assertThat(tokenizer.findTokenStart(" :test1 @test2", 9), is(8)); }
@Override public int findTokenStart(CharSequence text, int cursor) { if (text.length() == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor - 1; i >= 0; i--) { if (matchesPrefix(text, i)) { char charAt; if (i == 0 || (charAt = text.charAt(i - 1)) == separator || charAt == NEW_LINE) { return i; } } } return cursor; }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenStart(CharSequence text, int cursor) { if (text.length() == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor - 1; i >= 0; i--) { if (matchesPrefix(text, i)) { char charAt; if (i == 0 || (charAt = text.charAt(i - 1)) == separator || charAt == NEW_LINE) { return i; } } } return cursor; } }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenStart(CharSequence text, int cursor) { if (text.length() == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor - 1; i >= 0; i--) { if (matchesPrefix(text, i)) { char charAt; if (i == 0 || (charAt = text.charAt(i - 1)) == separator || charAt == NEW_LINE) { return i; } } } return cursor; } PrefixTokenizer(char prefix);  PrefixTokenizer(char... prefixes); }
PrefixTokenizer implements MultiAutoCompleteTextView.Tokenizer { @Override public int findTokenStart(CharSequence text, int cursor) { if (text.length() == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor - 1; i >= 0; i--) { if (matchesPrefix(text, i)) { char charAt; if (i == 0 || (charAt = text.charAt(i - 1)) == separator || charAt == NEW_LINE) { return i; } } } return cursor; } 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 int findTokenStart(CharSequence text, int cursor) { if (text.length() == 0) { return 0; } char separator = getDefaultSeparator(); for (int i = cursor - 1; i >= 0; i--) { if (matchesPrefix(text, i)) { char charAt; if (i == 0 || (charAt = text.charAt(i - 1)) == separator || charAt == NEW_LINE) { return i; } } } return cursor; } 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);  }