@Override
    @Nullable
    public QueryToken getQueryTokenIfValid() {
        if (mTokenizer == null) {
            return null;
        }

        // Use current text to determine the start and end index of the token
        MentionsEditable text = getMentionsText();
        int cursor = Math.max(getSelectionStart(), 0);
        int start = mTokenizer.findTokenStart(text, cursor);
        int end = mTokenizer.findTokenEnd(text, cursor);

        if (!mTokenizer.isValidMention(text, start, end)) {
            return null;
        }

        String tokenString = text.subSequence(start, end).toString();
        char firstChar = tokenString.charAt(0);
        boolean isExplicit = mTokenizer.isExplicitChar(tokenString.charAt(0));
        return (isExplicit ? new QueryToken(tokenString, firstChar) : new QueryToken(tokenString));
    }
@Override
    @Nullable
    public QueryToken getQueryTokenIfValid() {
        if (mTokenizer == null) {
            return null;
        }

        
        MentionsEditable text = getMentionsText();
        int cursor = Math.max(getSelectionStart(), 0);
        int start = mTokenizer.findTokenStart(text, cursor);
        int end = mTokenizer.findTokenEnd(text, cursor);

        if (!mTokenizer.isValidMention(text, start, end)) {
            return null;
        }

        String tokenString = text.subSequence(start, end).toString();
        char firstChar = tokenString.charAt(0);
        boolean isExplicit = mTokenizer.isExplicitChar(tokenString.charAt(0));
        return (isExplicit ? new QueryToken(tokenString, firstChar) : new QueryToken(tokenString));
    }
@ Override @ Nullable public QueryToken getQueryTokenIfValid ( ) { if ( mTokenizer == null ) { return null ; } // Use current text to determine the start and end index of the token MentionsEditable text = getMentionsText ( ) ; int cursor = Math . max ( getSelectionStart ( ) , 0 ) ; int start = mTokenizer . findTokenStart ( text , cursor ) ; int end = mTokenizer . findTokenEnd ( text , cursor ) ; if ( ! mTokenizer . isValidMention ( text , start , end ) ) { return null ; } String tokenString = text . subSequence ( start , end ) . toString ( ) ; char firstChar = tokenString . charAt ( 0 ) ; boolean isExplicit = mTokenizer . isExplicitChar ( tokenString . charAt ( 0 ) ) ; return ( isExplicit ? new QueryToken ( tokenString , firstChar ) : new QueryToken ( tokenString ) ) ; }
{@inheritDoc}
{