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);
  }
Exemplo n.º 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);
  }
Exemplo n.º 6
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;
  }
  @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;
  }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
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;
  }
Exemplo n.º 10
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);
  }
 @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);
 }
Exemplo n.º 12
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);
  }
Exemplo n.º 13
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;
  }
Exemplo n.º 14
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;
 }
  @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);
  }
Exemplo n.º 16
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_words, menu);

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

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

    mSearchView = (SearchView) searchMenuItem.getActionView();
    mSearchView.setQueryHint(getString(R.string.search_hint));

    if (mFilterText != null) {
      String query = mFilterText;
      searchMenuItem.expandActionView();
      mSearchView.setQuery(query, true);
      mSearchView.clearFocus();
    }
    setSearchViewTextChangeListener();
  }
Exemplo n.º 17
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);
  }
  @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);
  }
Exemplo n.º 19
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;
  }
Exemplo n.º 20
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();
  }
  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;
          }
        });
  }
Exemplo n.º 22
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);
  }
  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;
          }
        });
  }
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem searchItem = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.requestFocus();

    return true;
  }
Exemplo n.º 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;
 }
Exemplo n.º 26
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);
 }
Exemplo n.º 27
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    /*getMenuInflater().inflate(R.menu.common_actionbar, _menu);

    this.menu = _menu;

    SearchManager manager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    menuSearch = menu.findItem(R.id.search);
    menuform = menu.findItem(R.id.survey_mi);

    final SearchView search = (SearchView) menu.findItem(R.id.search).getActionView();
    search.setQueryHint(Html.fromHtml("<font color = #FFFFFF>" + getResources().getString(R.string.search) + "</font>"));
    Log.d("bis", "pl info= " + manager.getSearchableInfo(getComponentName()).getSearchActivity());
    search.setSearchableInfo(manager.getSearchableInfo(getComponentName()));

    search.setOnQueryTextListener(new OnQueryTextListener()
    {

        @Override
        public boolean onQueryTextChange(String query)
        {
            Log.d("bis", "sv query pl" + query);
            if (query.toString().length() < 1)
            {
                return true;
            }
            else
            {
                loadHistory(query);

                return true;
            }
        }

        @Override
        public boolean onQueryTextSubmit(String query)
        {
            // TODO Auto-generated method stub
            return false;
        }

    });


    return true;*/

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.common_actionbar, menu);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    return true;
  }
Exemplo n.º 28
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) {
   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;
 }
Exemplo n.º 30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_contactlist);

    mAppController = AppController.getInstance();
    mContext = this;

    tvHinweis = (TextView) findViewById(R.id.tvHinweis);

    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_contacts_toolbar);
    if (toolbar != null) {
      setSupportActionBar(toolbar);
      getSupportActionBar().setDisplayShowHomeEnabled(true);
      // getSupportActionBar().setSubtitle(null);
    }

    suggestions =
        new SearchRecentSuggestions(
            this, OrderSuggestionProvider.AUTHORITY, OrderSuggestionProvider.MODE);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView = new SearchView(getSupportActionBar().getThemedContext());
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);
    searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH); // Lupe anzeigen in der Tastatur
    // searchView.setSubmitButtonEnabled(true); //OK-Button anzeigen
    SearchView.SearchAutoComplete searchAutoComplete =
        (SearchView.SearchAutoComplete)
            searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);

    // Collapse the search menu when the user hits the back key
    searchAutoComplete.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {

          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) showSearch(false);
          }
        });

    try {
      // This sets the cursor resource ID to 0 or @null which will make it visible on white
      // background
      Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
      mCursorDrawableRes.setAccessible(true);
      mCursorDrawableRes.set(searchAutoComplete, 0);

    } catch (Exception e) {
    }

    checkServerConnection checkServerConnection = new checkServerConnection();
    checkServerConnection.execute("qw1");
  }