Search in sources :

Example 6 with SearchView

use of android.support.v7.widget.SearchView in project MaterialSearchView by MiguelCatalan.

the class ColoredActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_colored);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    searchView = (MaterialSearchView) findViewById(R.id.search_view);
    searchView.setVoiceSearch(false);
    searchView.setCursorDrawable(R.drawable.color_cursor_white);
    searchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
    searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            Snackbar.make(findViewById(R.id.container), "Query: " + query, Snackbar.LENGTH_LONG).show();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            //Do some magic
            return false;
        }
    });
    searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {

        @Override
        public void onSearchViewShown() {
        //Do some magic
        }

        @Override
        public void onSearchViewClosed() {
        //Do some magic
        }
    });
}
Also used : MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with SearchView

use of android.support.v7.widget.SearchView in project MaterialSearchView by MiguelCatalan.

the class DefaultActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_default);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    searchView = (MaterialSearchView) findViewById(R.id.search_view);
    searchView.setVoiceSearch(false);
    searchView.setCursorDrawable(R.drawable.custom_cursor);
    searchView.setEllipsize(true);
    searchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
    searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            Snackbar.make(findViewById(R.id.container), "Query: " + query, Snackbar.LENGTH_LONG).show();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            //Do some magic
            return false;
        }
    });
    searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {

        @Override
        public void onSearchViewShown() {
        //Do some magic
        }

        @Override
        public void onSearchViewClosed() {
        //Do some magic
        }
    });
}
Also used : MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) Toolbar(android.support.v7.widget.Toolbar)

Example 8 with SearchView

use of android.support.v7.widget.SearchView in project MaterialSearchView by MiguelCatalan.

the class InputTypeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_input_type);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    searchView = (MaterialSearchView) findViewById(R.id.search_view);
    searchView.setVoiceSearch(false);
    searchView.setCursorDrawable(R.drawable.custom_cursor);
    searchView.setEllipsize(true);
    searchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
    searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            Snackbar.make(findViewById(R.id.container), "Query: " + query, Snackbar.LENGTH_LONG).show();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            //Do some magic
            return false;
        }
    });
    searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {

        @Override
        public void onSearchViewShown() {
        //Do some magic
        }

        @Override
        public void onSearchViewClosed() {
        //Do some magic
        }
    });
}
Also used : MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) Toolbar(android.support.v7.widget.Toolbar)

Example 9 with SearchView

use of android.support.v7.widget.SearchView in project MaterialSearchView by MiguelCatalan.

the class VoiceActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_voice);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    searchView = (MaterialSearchView) findViewById(R.id.search_view);
    searchView.setVoiceSearch(true);
    searchView.setCursorDrawable(R.drawable.color_cursor_white);
    searchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
    searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            Snackbar.make(findViewById(R.id.container), "Query: " + query, Snackbar.LENGTH_LONG).show();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            //Do some magic
            return false;
        }
    });
    searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {

        @Override
        public void onSearchViewShown() {
        //Do some magic
        }

        @Override
        public void onSearchViewClosed() {
        //Do some magic
        }
    });
}
Also used : MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) Toolbar(android.support.v7.widget.Toolbar)

Example 10 with SearchView

use of android.support.v7.widget.SearchView in project actor-platform by actorapp.

the class BaseContactFragment method onCreateOptionsMenu.

// Search menu
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (userSearch) {
        inflater.inflate(R.menu.compose, menu);
        SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                filter(newText);
                return true;
            }
        });
    }
}
Also used : SearchView(android.support.v7.widget.SearchView)

Aggregations

SearchView (android.support.v7.widget.SearchView)67 MenuItem (android.view.MenuItem)40 View (android.view.View)19 MenuItemCompat (android.support.v4.view.MenuItemCompat)13 SearchManager (android.app.SearchManager)11 RecyclerView (android.support.v7.widget.RecyclerView)10 MenuInflater (android.view.MenuInflater)10 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)10 Toolbar (android.support.v7.widget.Toolbar)8 MaterialSearchView (com.miguelcatalan.materialsearchview.MaterialSearchView)7 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)6 SuppressLint (android.annotation.SuppressLint)5 ActionBar (android.support.v7.app.ActionBar)5 Button (android.widget.Button)4 ComponentName (android.content.ComponentName)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 SpannableString (android.text.SpannableString)3 AutoCompleteTextView (android.widget.AutoCompleteTextView)3