private void UpdateArtistsOnKeysEntered(View rootView) {
    final SearchView searchText = (SearchView) rootView.findViewById(R.id.search_text);
    searchText.setIconifiedByDefault(false);
    searchText.setQueryHint(getResources().getString(R.string.query_artist_hint));
    searchText.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            mArtistQuery = searchText.getQuery().toString();
            UpdateArtistResults(mArtistQuery);
            getLoaderManager()
                .restartLoader(
                    Constants.LOADER_ID.ARTIST_LOADER,
                    null,
                    (ArtistSearchFragment)
                        getFragmentManager().findFragmentById(R.id.fragment_artist_search));
            return false;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            mArtistQuery = searchText.getQuery().toString();
            UpdateArtistResults(mArtistQuery);
            getLoaderManager()
                .restartLoader(
                    Constants.LOADER_ID.ARTIST_LOADER,
                    null,
                    (ArtistSearchFragment)
                        getFragmentManager().findFragmentById(R.id.fragment_artist_search));
            return false;
          }
        });
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.search, menu);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
      searchView.setOnQueryTextListener(
          new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String s) {
              touchCallback.setIsDragEnabled(false);
              fastItemAdapter.filter(s);
              return true;
            }

            @Override
            public boolean onQueryTextChange(String s) {
              fastItemAdapter.filter(s);
              touchCallback.setIsDragEnabled(TextUtils.isEmpty(s));
              return true;
            }
          });
    } else {
      menu.findItem(R.id.search).setVisible(false);
    }

    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.setGroupVisible(R.id.sortGroup, true);
    menu.findItem(R.id.search).setVisible(true);

    SearchManager searchManager =
        (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
    searchView.setSubmitButtonEnabled(true);
    searchView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextChange(String newText) {
            searchFilter(newText);
            return true;
          }

          @Override
          public boolean onQueryTextSubmit(String query) {
            InputMethodManager imm =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
            return true;
          }
        });
    searchView.setOnFocusChangeListener(searchViewOnFocusChangeListener);
  }
예제 #4
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);

    menu.findItem(R.id.action_settings).setIntent(new Intent(this, SettingsActivity.class));
    // SearchView options
    searchItem = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) searchItem.getActionView();
    searchView.setQueryHint(getString(R.string.search_hint));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            return true;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            Log.d(Constants.TAG, "search query : '" + newText + "'");
            List<OrgInfoModel> searchData = new ArrayList<>();
            for (OrgInfoModel model : mData) {
              if (model.containStr(newText)) searchData.add(model);
            }
            mAdapter.setData(searchData);
            return true;
          }
        });
    return true;
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflator) {
    if (menu.findItem(R.id.action_search) == null) {
      inflator.inflate(R.menu.menu_recyceler_view, menu);
    }

    SearchView search = (SearchView) menu.findItem(R.id.action_search).getActionView();
    if (search != null) {
      search.setOnQueryTextListener(
          new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
              int position = soccerData.findFirst(query);
              if (position >= 0) mRecyclerView.smoothScrollToPosition(position);
              return true;
            }

            @Override
            public boolean onQueryTextChange(String query) {
              return true;
            }
          });
    }
    super.onCreateOptionsMenu(menu, inflator);
  }
예제 #6
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_search, container, false);
    ButterKnife.bind(this, rootView);

    presenter = new SearchPresenterImpl(this);

    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    searchView.onActionViewExpanded();
    searchView.requestFocus();
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            presenter.begin(query);
            return true;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            return false;
          }
        });
    return rootView;
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main_menu, menu);

    MenuItem item = menu.findItem(R.id.action_search);
    SearchView itemSearch = (SearchView) item.getActionView();
    itemSearch.setOnQueryTextListener(onQueryTextListener);
    itemSearch.setQueryHint(getString(R.string.action_search));

    MenuItemCompat.setOnActionExpandListener(
        item,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            return true;
          }
        });

    return super.onCreateOptionsMenu(menu);
  }
예제 #8
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mSearchView = (SearchView) menu.findItem(R.id.search).getActionView();
    mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    mSearchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {

            //                mNoteList = mDbHelper.queryName(query);
            //                mAdapter.notifyDataSetChanged();
            return false;
          }

          @Override
          public boolean onQueryTextChange(String newText) {

            if (TextUtils.isEmpty(newText)) {
              mNoteList = mDbHelper.queryAll();
            } else {
              mNoteList = mDbHelper.queryName(newText);
            }
            sortList(mNoteList);
            mAdapter.notifyDataSetChanged();
            return true;
          }
        });

    return true;
  }
예제 #9
0
  /**
   * *********************************************************************************************
   */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_search, menu);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    searchView.setSubmitButtonEnabled(true);
    searchView.setQuery(searchText, true);
    searchView.setIconifiedByDefault(false);
    searchView.setQueryHint("Search Images ..");

    SearchView.OnQueryTextListener textChangeListener =
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextChange(String newText) {

            return true;
          }

          @Override
          public boolean onQueryTextSubmit(String queryValue) {
            searchText = queryValue;
            currentPage = 1;
            imageItemList.clear();
            imageItemAdapter.notifyDataSetChanged();
            refreshItems(currentPage);
            return true;
          }
        };
    searchView.setOnQueryTextListener(textChangeListener);
    return true;
  }
예제 #10
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.dap_asset_issuer_home_menu, menu);
    searchView = (SearchView) menu.findItem(R.id.action_wallet_issuer_search).getActionView();
    searchView.setQueryHint(getResources().getString(R.string.dap_issuer_wallet_search_hint));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String s) {
            return false;
          }

          @Override
          public boolean onQueryTextChange(String s) {
            if (s.equals(searchView.getQuery().toString())) {
              ((MyAssetsAdapterFilter) ((MyAssetsAdapter) getAdapter()).getFilter()).filter(s);
            }
            return false;
          }
        });
    menu.add(0, SessionConstantsAssetIssuer.IC_ACTION_ISSUER_HELP_PRESENTATION, 2, "Help")
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    //        super.onCreateOptionsMenu(menu, inflater);
    //        searchView = (SearchView) menu.getItem(1).getActionView();
  }
예제 #11
0
  @Override
  public boolean onCreateOptionsMenu(final Menu menu) {

    getMenuInflater().inflate(R.menu.menu_search, menu);

    mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search));

    mSearchView.setOnQueryTextListener(this);
    mSearchView.setQueryHint(getString(R.string.search_library));

    mSearchView.setIconifiedByDefault(false);
    mSearchView.setIconified(false);

    MenuItemCompat.setOnActionExpandListener(
        menu.findItem(R.id.menu_search),
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            finish();
            return false;
          }
        });

    menu.findItem(R.id.menu_search).expandActionView();
    return super.onCreateOptionsMenu(menu);
  }
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    this.menu = menu;
    MenuInflater inflater = getMenuInflater();
    if (mode != PRESENT_VIDEOS_MODE && findViewById(R.id.videoitem_detail_container) == null) {
      inflater.inflate(R.menu.videoitem_list, menu);
      MenuItem searchItem = menu.findItem(R.id.action_search);
      SearchView searchView = (SearchView) searchItem.getActionView();
      searchView.setFocusable(false);
      searchView.setOnQueryTextListener(new SearchVideoQueryListener());
      suggestionListAdapter = new SuggestionListAdapter(this);
      searchView.setSuggestionsAdapter(suggestionListAdapter);
      searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView));
      if (!searchQuery.isEmpty()) {
        searchView.setQuery(searchQuery, false);
        searchView.setIconifiedByDefault(false);
      }
    } else if (videoFragment != null) {
      videoFragment.onCreateOptionsMenu(menu, inflater);
    } else {
      inflater.inflate(R.menu.videoitem_two_pannel, menu);
    }

    return true;
  }
  private void initActionView(MenuItem searchItem) {
    if (searchView != null) return;
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    try { // 更改搜索按钮的icon
      int searchImgId = getResources().getIdentifier("android:id/search_button", null, null);
      ImageView v = (ImageView) searchView.findViewById(searchImgId);
      v.setImageResource(R.drawable.ic_menu_search);
    } catch (Exception e) {
      Global.errorLog(e);
    }
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String s) {
            return true;
          }

          @Override
          public boolean onQueryTextChange(String s) {
            ++sSearchPos;
            searchAdapter.reload(searchView.getQuery().toString());
            return true;
          }
        });
  }
예제 #14
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_bus_stops, menu);

    final MenuItem item = menu.findItem(R.id.action_search);
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
    searchView.setOnQueryTextListener(this);

    MenuItemCompat.setOnActionExpandListener(
        item,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            // Do something when collapsed
            return true; // Return true to collapse action view
          }

          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            // Do something when expanded
            return true; // Return true to expand action view
          }
        });
    return true;
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_search, menu);

    MenuItem searchItem = menu.findItem(R.id.action_search);
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setIconifiedByDefault(false);
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            // perform query here
            SearchTweetsFragment searchTweetsFragment = SearchTweetsFragment.newInstance(query);
            FragmentTransaction fragmentTransaction =
                getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.fragment_search, searchTweetsFragment);
            fragmentTransaction.commit();

            // Clear the search box
            searchView.clearFocus();

            return true;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            return false;
          }
        });

    return true;
  }
예제 #16
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   MenuItem searchItem = menu.findItem(R.id.action_search);
   SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
   searchView.setOnQueryTextListener(this);
 }
예제 #17
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.search_menu, menu);
    MenuItem searchItem = menu.findItem(R.id.search_menu);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setQueryHint(getString(R.string.enter_user_name));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            if (mUsersAdapter != null) {
              mUsersAdapter.getFilter().filter(query);
            }
            return true;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            if (mUsersAdapter != null) {
              mUsersAdapter.getFilter().filter(newText);
            }
            return true;
          }
        });
    return true;
  }
예제 #18
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu
    getMenuInflater().inflate(R.menu.main, menu);

    mSearchMenuItem = menu.findItem(R.id.menu_act_filter);
    MenuItemCompat.setOnActionExpandListener(
        mSearchMenuItem,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem menuItem) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem menuItem) {
            notifyQueryChange("");
            return true;
          }
        });

    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(mSearchMenuItem);
    searchView.setOnQueryTextListener(this);
    searchView.setSubmitButtonEnabled(true);
    searchView.setQueryHint(getString(R.string.search));

    mRefreshAnim.setMenuItem(menu.findItem(R.id.menu_act_refresh));
    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getMenuInflater();
    menuInflater.inflate(R.menu.activity_recent_menu, menu);

    MenuItem searchItem = menu.findItem(R.id.activity_recent_search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    // searchView.setOnQueryTextListener(this);
    searchView.setQueryHint(getString(R.string.hint_search_activity_recent));
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    // Handle the query that user types in action bar search field
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            Intent intent = new Intent(RecentActivity.this, SearchResultsActivity.class);
            intent.putExtra("query", query);
            startActivity(intent);
            return false;
          }

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

    return super.onCreateOptionsMenu(menu);
  }
예제 #20
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.action_search, menu);
    // MenuItem searchItem = menu.findItem(R.id.search);
    // SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView = (SearchView) menu.findItem(R.id.search).getActionView();

    // Sets the default or resting state of the search field. If true, a single search icon is shown
    // by default and
    // expands to show the text field and other buttons when pressed. Also, if the default state is
    // iconified, then it
    // collapses to that state when the close button is pressed. Changes to this property will take
    // effect immediately.
    // The default value is true.
    searchView.setIconifiedByDefault(false);

    searchView.setOnQueryTextListener(this);
    searchView.setOnCloseListener(this);
    new SearchViewFormatter()
        // .setSearchBackGroundResource(R.color.actionbar_background)
        .setSearchIconResource(
            R.drawable.buscar, false, true) // true to icon inside edittext, false to outside
        // .setSearchVoiceIconResource(R.drawable.buscar)
        .setSearchTextColorResource(R.color.actionbar_text)
        // .setSearchHintColorResource(R.color.actionbar_text)
        // .setSearchCloseIconResource(R.drawable.buscar)
        .setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
        .format(searchView);
    return super.onCreateOptionsMenu(menu);
  }
예제 #21
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    if (fdroidApp.bluetoothAdapter == null) {
      // ignore on devices without Bluetooth
      MenuItem btItem = menu.findItem(R.id.action_bluetooth_apk);
      btItem.setVisible(false);
    }

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    // LayoutParams.MATCH_PARENT does not work, use a big value instead
    searchView.setMaxWidth(1000000);
    searchView.setOnQueryTextListener(this);

    // If we were asked to execute a search before getting around to building the options
    // menu, then we should deal with that now that the options menu is all sorted out.
    if (pendingSearchQuery != null) {
      performSearch(pendingSearchQuery);
      pendingSearchQuery = null;
    }

    return super.onCreateOptionsMenu(menu);
  }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   SearchView searchView = (SearchView) searchMenuItem.getActionView();
   searchView.setOnQueryTextListener(this);
   searchView.setQueryHint(getString(R.string.ro_search));
   return super.onCreateOptionsMenu(menu);
 }
예제 #23
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   getMenuInflater().inflate(R.menu.menu_main, menu);
   SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
   searchView.setOnQueryTextListener(this);
   return true;
 }
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.search, menu);

    final android.support.v7.widget.SearchView searchView =
        (android.support.v7.widget.SearchView)
            MenuItemCompat.getActionView(menu.findItem(R.id.search));

    final MenuItem searchMenuItem = menu.findItem(R.id.search);

    searchView.setOnQueryTextFocusChangeListener(
        new View.OnFocusChangeListener() {

          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
              searchMenuItem.collapseActionView();
              searchView.setQuery("", false);
            }
          }
        });

    searchView.setOnQueryTextListener(
        new android.support.v7.widget.SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextChange(String newText) {

            textlength = newText.length();
            list.clear();

            for (int i = 0; i < str_title.length; i++) {
              if (textlength <= str_title[i].length()) {
                if (str_title[i].toLowerCase().contains(newText.toLowerCase())) {

                  ItemRecent objItem = new ItemRecent();

                  objItem.setCategoryName((str_cat_name[i]));
                  objItem.setCatId(str_cat_id[i]);
                  objItem.setCId(str_cid[i]);
                  objItem.setNewsDate(str_date[i]);
                  objItem.setNewsDescription(str_desc[i]);
                  objItem.setNewsHeading(str_title[i]);
                  objItem.setNewsImage(str_image[i]);
                  list.add(objItem);
                }
              }
            }

            setAdapterToListview();
            return false;
          }

          @Override
          public boolean onQueryTextSubmit(String query) {

            return true;
          }
        });
  }
예제 #25
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   getMenuInflater().inflate(R.menu.menu_liste_fiche, menu);
   final MenuItem item = menu.findItem(R.id.action_search);
   final SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
   searchView.setOnQueryTextListener(this);
   return true;
 }
예제 #26
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   getMenuInflater().inflate(R.menu.main, menu);
   if (android.os.Build.VERSION.SDK_INT > 7) {
     SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
     searchView.setOnQueryTextListener(this); // 设置监听器
   }
   return true;
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   getMenuInflater().inflate(R.menu.menu_faq, menu);
   mSearchMenu = menu.findItem(R.id.menu_search);
   mSearchView = (android.support.v7.widget.SearchView) mSearchMenu.getActionView();
   mSearchView.setOnQueryTextListener(this);
   return true;
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.actions, menu);
   SearchView searchView =
       (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
   searchView.setOnQueryTextListener(mOnQueryTextListener);
   return true;
 }
예제 #29
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.media_search, menu);
   MenuItem searchItem = menu.findItem(R.id.action_search);
   SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
   searchView.setOnQueryTextListener(this);
   searchView.setQueryHint(getString(R.string.action_search_artists));
   super.onCreateOptionsMenu(menu, inflater);
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.menu_select_program, menu);
   MenuItem item = menu.findItem(R.id.action_search);
   SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
   MenuItemCompat.setOnActionExpandListener(item, this);
   searchView.setOnQueryTextListener(this);
   searchView.setOnQueryTextFocusChangeListener(this);
 }