android.widget.SearchView.OnQueryTextListener Java Examples

The following examples show how to use android.widget.SearchView.OnQueryTextListener. 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: SearchViewCompatHoneycomb.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public static Object newOnQueryTextListener(final OnQueryTextListenerCompatBridge listener) {
    return new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return listener.onQueryTextSubmit(query);
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return listener.onQueryTextChange(newText);
        }
    };
}
 
Example #2
Source File: ProgrammaticAutocompleteToolbarActivity.java    From android-places-demos with Apache License 2.0 5 votes vote down vote up
private void initSearchView(SearchView searchView) {
    searchView.setQueryHint(getString(R.string.search_a_place));
    searchView.setIconifiedByDefault(false);
    searchView.setFocusable(true);
    searchView.setIconified(false);
    searchView.requestFocusFromTouch();
    searchView.setOnQueryTextListener(new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            progressBar.setIndeterminate(true);

            // Cancel any previous place prediction requests
            handler.removeCallbacksAndMessages(null);

            // Start a new place prediction request in 300 ms
            handler.postDelayed(() -> {
                getPlacePredictions(newText);
            }, 300);
            return true;
        }
    });
}
 
Example #3
Source File: ProgrammaticAutocompleteToolbarActivity.java    From android-places-demos with Apache License 2.0 5 votes vote down vote up
private void initSearchView(SearchView searchView) {
    searchView.setQueryHint(getString(R.string.search_a_place));
    searchView.setIconifiedByDefault(false);
    searchView.setFocusable(true);
    searchView.setIconified(false);
    searchView.requestFocusFromTouch();
    searchView.setOnQueryTextListener(new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            progressBar.setIndeterminate(true);

            // Cancel any previous place prediction requests
            handler.removeCallbacksAndMessages(null);

            // Start a new place prediction request in 300 ms
            handler.postDelayed(() -> {
                getPlacePredictions(newText);
            }, 300);
            return true;
        }
    });
}
 
Example #4
Source File: SearchViewCompatHoneycomb.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
public static Object newOnQueryTextListener(final OnQueryTextListenerCompatBridge listener) {
    return new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return listener.onQueryTextSubmit(query);
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return listener.onQueryTextChange(newText);
        }
    };
}
 
Example #5
Source File: SearchViewCompatHoneycomb.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
public static Object newOnQueryTextListener(final OnQueryTextListenerCompatBridge listener) {
    return new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return listener.onQueryTextSubmit(query);
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return listener.onQueryTextChange(newText);
        }
    };
}
 
Example #6
Source File: SearchViewCompatHoneycomb.java    From guideshow with MIT License 5 votes vote down vote up
public static Object newOnQueryTextListener(final OnQueryTextListenerCompatBridge listener) {
    return new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            return listener.onQueryTextSubmit(query);
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return listener.onQueryTextChange(newText);
        }
    };
}
 
Example #7
Source File: SearchViewCompatHoneycomb.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static void setOnQueryTextListener(Object searchView, Object listener) {
    ((SearchView) searchView).setOnQueryTextListener((OnQueryTextListener) listener);
}
 
Example #8
Source File: SearchViewCompatHoneycomb.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static void setOnQueryTextListener(Object searchView, Object listener) {
    ((SearchView) searchView).setOnQueryTextListener((OnQueryTextListener) listener);
}
 
Example #9
Source File: SearchViewCompatHoneycomb.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static void setOnQueryTextListener(Object searchView, Object listener) {
    ((SearchView) searchView).setOnQueryTextListener((OnQueryTextListener) listener);
}
 
Example #10
Source File: SearchViewCompatHoneycomb.java    From guideshow with MIT License 4 votes vote down vote up
public static void setOnQueryTextListener(Object searchView, Object listener) {
    ((SearchView) searchView).setOnQueryTextListener((OnQueryTextListener) listener);
}