Java Code Examples for android.widget.Filter#filter()

The following examples show how to use android.widget.Filter#filter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoRunCommandListEditText.java    From revolution-irc with GNU General Public License v3.0 6 votes vote down vote up
private void performFiltering(boolean completeIfSingle) {
    final CharSequence text = getCurrentLineToken();
    if (text == null)
        return;
    Filter filter = mCommandAdapter.getFilter();
    filter.filter(text, (int i) -> {
        if (i == 0) {
            dismissDropDown();
            return;
        }
        if (!text.equals(getCurrentLineToken()) && !enoughToFilter())
            return;
        if (completeIfSingle && i == 1) {
            onItemClick(mCommandAdapter.getItem(0));
            return;
        }
        if (i > 0)
            showDropDown();
    });
}
 
Example 2
Source File: ChatAutoCompleteEditText.java    From revolution-irc with GNU General Public License v3.0 6 votes vote down vote up
private void performFiltering(boolean completeIfSingle) {
    if (!updateCompletingCommandFlags())
        mAdapter.setEnabledSuggestions(true, mDoChannelSuggestions, false);
    final String text = getCurrentToken();
    Filter filter = isCommandNameToken() ? mCommandAdapter.getFilter() : mAdapter.getFilter();
    filter.filter(text, (int i) -> {
        if (i == 0) {
            dismissDropDown();
            return;
        }
        if (!getCurrentToken().equals(text) && !enoughToFilter())
            return;
        if (completeIfSingle && i == 1) {
            if (filter == mCommandAdapter.getFilter())
                onItemClick(mCommandAdapter.getItem(0));
            else
                onItemClick(mAdapter.getItem(0));
            return;
        }
        if (i > 0) {
            setCurrentCommandAdapter(filter == mCommandAdapter.getFilter());
            showDropDown();
        }
    });
}
 
Example 3
Source File: TokenCompleteTextView.java    From SocialTokenAutoComplete with Apache License 2.0 5 votes vote down vote up
@Override
protected void performFiltering(CharSequence text, int start, int end,
                                int keyCode) {
    if (start < prefix.length()) {
        start = prefix.length();
    }
    Filter filter = getFilter();
    if (filter != null) {
        filter.filter(text.subSequence(start, end), this);
    }
}
 
Example 4
Source File: TokenCompleteTextView.java    From TokenAutoComplete with Apache License 2.0 5 votes vote down vote up
@Override
protected void performFiltering(CharSequence text, int keyCode) {
    Filter filter = getFilter();
    if (filter != null) {
        filter.filter(currentCompletionText(), this);
    }
}
 
Example 5
Source File: LogcatActivity.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
private void search(String filterText) {
    Filter filter = mLogListAdapter.getFilter();
    filter.filter(filterText, this);
    mSearchingString = filterText;
}
 
Example 6
Source File: LogcatActivity.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private void search(String filterText) {
    Filter filter = mLogListAdapter.getFilter();
    filter.filter(filterText, this);
    mSearchingString = filterText;
}
 
Example 7
Source File: LogcatActivity.java    From matlog with GNU General Public License v3.0 4 votes vote down vote up
private void search(String filterText) {
    Filter filter = mLogListAdapter.getFilter();
    filter.filter(filterText, this);
    mSearchingString = filterText;
}
 
Example 8
Source File: MainActivity.java    From ActivityLauncher with ISC License 4 votes vote down vote up
private void onFilter(String query) {
    Filter filter = filterTarget.getFilter();
    if (filter != null) {
        filter.filter(query);
    }
}