Search in sources :

Example 46 with SearchView

use of android.support.v7.widget.SearchView in project android_packages_apps_GmsCore by microg.

the class PlacePickerActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.pick_place, menu);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_action_search));
    // TODO: search
    return true;
}
Also used : SearchView(android.support.v7.widget.SearchView) MenuInflater(android.view.MenuInflater)

Example 47 with SearchView

use of android.support.v7.widget.SearchView in project MaxLock by Maxr1998.

the class AppListFragment method onCreateOptionsMenu.

@Override
public void onCreateOptionsMenu(final Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.applist_menu, menu);
    super.onCreateOptionsMenu(menu, inflater);
    menu.setGroupVisible(R.id.menu_group_default, false);
    final SearchView searchView = (SearchView) menu.findItem(R.id.toolbar_search).getActionView();
    searchView.setOnSearchClickListener(v -> menu.setGroupVisible(R.id.menu_group_hide_on_search, false));
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String s) {
            Util.hideKeyboardFromWindow(getActivity(), searchView);
            return true;
        }

        @Override
        public boolean onQueryTextChange(String s) {
            mAdapter.getFilter().filter(s);
            return true;
        }
    });
    searchView.setOnCloseListener(() -> {
        menu.setGroupVisible(R.id.menu_group_hide_on_search, true);
        return false;
    });
    filterIcon(menu.findItem(R.id.toolbar_filter_activated));
    menu.findItem(R.id.toolbar_load_all).setTitle(LOAD_ALL ? R.string.menu_only_openable : R.string.menu_all_apps);
}
Also used : SearchView(android.support.v7.widget.SearchView)

Example 48 with SearchView

use of android.support.v7.widget.SearchView in project fuckView by w568w.

the class MainActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    final MenuItem item = menu.findItem(R.id.action_search);
    SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(item);
    mSearchView.setIconifiedByDefault(true);
    mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

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

        @Override
        public boolean onQueryTextChange(String newText) {
            if (shouldShowFAQ) {
                ((Searchable) currentFragment).setSearchText(newText);
            }
            return true;
        }
    });
    return super.onCreateOptionsMenu(menu);
}
Also used : SearchView(android.support.v7.widget.SearchView) MenuItem(android.view.MenuItem)

Example 49 with SearchView

use of android.support.v7.widget.SearchView in project ForPDA by RadiationX.

the class AnnounceFragment method addSearchOnPageItem.

private void addSearchOnPageItem(Menu menu) {
    toolbar.inflateMenu(R.menu.theme_search_menu);
    MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search);
    searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView();
    searchView.setTag(searchViewTag);
    searchView.setOnSearchClickListener(v -> {
        if (searchView.getTag().equals(searchViewTag)) {
            ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
            if (searchClose != null)
                ((ViewGroup) searchClose.getParent()).removeView(searchClose);
            ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48);
            TypedValue outValue = new TypedValue();
            getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true);
            AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext());
            btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next));
            btnNext.setBackgroundResource(outValue.resourceId);
            AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext());
            btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev));
            btnPrev.setBackgroundResource(outValue.resourceId);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams);
            btnNext.setOnClickListener(v1 -> findNext(true));
            btnPrev.setOnClickListener(v1 -> findNext(false));
            searchViewTag++;
        }
    });
    SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
    if (null != searchManager) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
    }
    searchView.setIconifiedByDefault(true);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

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

        @Override
        public boolean onQueryTextChange(String newText) {
            findText(newText);
            return false;
        }
    });
}
Also used : SearchManager(android.app.SearchManager) ViewGroup(android.view.ViewGroup) MenuItem(android.view.MenuItem) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout) TypedValue(android.util.TypedValue)

Example 50 with SearchView

use of android.support.v7.widget.SearchView in project ForPDA by RadiationX.

the class ForumRulesFragment method addSearchOnPageItem.

private void addSearchOnPageItem(Menu menu) {
    toolbar.inflateMenu(R.menu.theme_search_menu);
    MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search);
    searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    /*MenuItemCompat.setOnActionExpandListener(searchOnPageMenuItem, new MenuItemCompat.OnActionExpandListener() {
            @Override
            public boolean onMenuItemActionCollapse(MenuItem item) {
                toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
                return true;
            }

            @Override
            public boolean onMenuItemActionExpand(MenuItem item) {
                toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER);
                return true;
            }
        });*/
    SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView();
    searchView.setTag(searchViewTag);
    searchView.setOnSearchClickListener(v -> {
        if (searchView.getTag().equals(searchViewTag)) {
            ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
            if (searchClose != null)
                ((ViewGroup) searchClose.getParent()).removeView(searchClose);
            ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48);
            TypedValue outValue = new TypedValue();
            getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true);
            AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext());
            btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next));
            btnNext.setBackgroundResource(outValue.resourceId);
            AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext());
            btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev));
            btnPrev.setBackgroundResource(outValue.resourceId);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams);
            btnNext.setOnClickListener(v1 -> findNext(true));
            btnPrev.setOnClickListener(v1 -> findNext(false));
            searchViewTag++;
        }
    });
    SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
    if (null != searchManager) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
    }
    searchView.setIconifiedByDefault(true);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

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

        @Override
        public boolean onQueryTextChange(String newText) {
            findText(newText);
            return false;
        }
    });
}
Also used : SearchManager(android.app.SearchManager) ViewGroup(android.view.ViewGroup) MenuItem(android.view.MenuItem) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout) TypedValue(android.util.TypedValue)

Aggregations

SearchView (android.support.v7.widget.SearchView)151 MenuItem (android.view.MenuItem)88 View (android.view.View)56 SearchManager (android.app.SearchManager)37 RecyclerView (android.support.v7.widget.RecyclerView)35 TextView (android.widget.TextView)26 MenuInflater (android.view.MenuInflater)24 ImageView (android.widget.ImageView)20 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)19 MenuItemCompat (android.support.v4.view.MenuItemCompat)18 Toolbar (android.support.v7.widget.Toolbar)16 SearchView (android.widget.SearchView)12 ArrayList (java.util.ArrayList)11 ViewGroup (android.view.ViewGroup)10 MaterialSearchView (com.miguelcatalan.materialsearchview.MaterialSearchView)10 Intent (android.content.Intent)9 ListView (android.widget.ListView)9 BindView (butterknife.BindView)9 AdapterView (android.widget.AdapterView)8 EditText (android.widget.EditText)8