android.widget.SearchView.getQuery()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中android.widget.SearchView.getQuery()方法的一些代码示例,展示了SearchView.getQuery()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SearchView.getQuery()方法的具体详情如下:
包路径:android.widget.SearchView
类名称:SearchView
方法名:getQuery

SearchView.getQuery介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onSaveInstanceState(Bundle state) {
 super.onSaveInstanceState(state);
 if (!sv.isIconified()) {
  state.putString(STATE_QUERY, sv.getQuery().toString());
 }
}

代码示例来源:origin: square/assertj-android

public SearchViewAssert hasQuery(CharSequence query) {
 isNotNull();
 CharSequence actualQuery = actual.getQuery();
 assertThat(actualQuery) //
   .overridingErrorMessage("Expected query <%s> but was <%s>.", query, actualQuery) //
   .isEqualTo(query);
 return this;
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onSaveInstanceState(Bundle state) {
 super.onSaveInstanceState(state);
 if (!sv.isIconified()) {
  state.putCharSequence(STATE_QUERY, sv.getQuery());
 }
 state.putStringArrayList(STATE_MODEL, words);
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static CharSequence getQuery(View searchView) {
  return ((SearchView) searchView).getQuery();
}

代码示例来源:origin: li2/learning-android-open-source

@Override
public boolean onClose() {
  if (!TextUtils.isEmpty(mSearchView.getQuery())) {
    mSearchView.setQuery(null, true);
  }
  return true;
}

代码示例来源:origin: li2/learning-android-open-source

@Override
public boolean onClose() {
  if (!TextUtils.isEmpty(mSearchView.getQuery())) {
    mSearchView.setQuery(null, true);
  }
  return true;
}

代码示例来源:origin: qiubiteme/android_api_demos

@Override
public boolean onClose() {
  if (!TextUtils.isEmpty(mSearchView.getQuery())) {
    mSearchView.setQuery(null, true);
  }
  return true;
}

代码示例来源:origin: li2/learning-android-open-source

@Override
public boolean onClose() {
  if (!TextUtils.isEmpty(mSearchView.getQuery())) {
    mSearchView.setQuery(null, true);
  }
  return true;
}

代码示例来源:origin: qiubiteme/android_api_demos

@Override
public boolean onClose() {
  if (!TextUtils.isEmpty(mSearchView.getQuery())) {
    mSearchView.setQuery(null, true);
  }
  return true;
}

代码示例来源:origin: qiubiteme/android_api_demos

@Override
public boolean onClose() {
  if (!TextUtils.isEmpty(mSearchView.getQuery())) {
    mSearchView.setQuery(null, true);
  }
  return true;
}

代码示例来源:origin: algolia/instantsearch-android

/**
 * Returns the query string currently in the text field.
 *
 * @return the query string
 */
@NonNull public CharSequence getQuery() {
  if (searchView != null) {
    return searchView.getQuery();
  } else if (supportView != null) {
    return supportView.getQuery();
  }
  throw new IllegalStateException(ERROR_NO_SEARCHVIEW);
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public SearchViewAssert hasQuery(CharSequence query) {
 isNotNull();
 CharSequence actualQuery = actual.getQuery();
 assertThat(actualQuery) //
   .overridingErrorMessage("Expected query <%s> but was <%s>.", query, actualQuery) //
   .isEqualTo(query);
 return this;
}

代码示例来源:origin: billthefarmer/diary

public void findAll()
{
  // Get search string
  String search = searchView.getQuery().toString();
  // Execute find task
  FindTask findTask = new FindTask(this);
  findTask.execute(search);
}

代码示例来源:origin: google/ringdroid

private void refreshListView() {
  mInternalCursor = null;
  mExternalCursor = null;
  Bundle args = new Bundle();
  args.putString("filter", mFilter.getQuery().toString());
  getLoaderManager().restartLoader(INTERNAL_CURSOR_ID,  args, this);
  getLoaderManager().restartLoader(EXTERNAL_CURSOR_ID,  args, this);
}

代码示例来源:origin: TeamWalrus/Walrus

@Override
public int getItemCount() {
  String filter = sv.getQuery().toString();
  if (!filter.isEmpty()) {
    List<Card> cards = QueryUtils.filterCards(getHelper().getCardDao(), filter);
    return cards.size();
  } else {
    return (int) getHelper().getCardDao().countOf();
  }
}

代码示例来源:origin: JBossOutreach/lead-management-android

@Override
public boolean onMenuItemActionExpand(MenuItem item) {
  if(item==searchMenuItem){
    mAdapter.getFilter().filter(searchView.getQuery());
    if( mAdapter.getDataSize() == 0){
      textView.setVisibility(View.VISIBLE);
    } else{
      textView.setVisibility(View.GONE);
    }
  }
  return true;
}

代码示例来源:origin: WeAreFairphone/FP2-Launcher

public void smartHide() {
  if (mActive && !mAnimating) {
    if (mIsKeyboardShowing) {
      hideKeyboard();
    } else if (!TextUtils.isEmpty(mSearchView.getQuery())) {
      mSearchView.setQuery("", false);
    } else {
      hideSearchView();
    }
  }
}

代码示例来源:origin: ckcz123/PKUHelper-Android

@SuppressWarnings("unchecked")
void search() {
  setPlayerStatus(AUDIO_TYPE_STOP);
  String type = "";
  Spinner spinner = (Spinner) findViewById(R.id.hole_search_spinner);
  int pos = spinner.getSelectedItemPosition();
  if (pos == 1) type = "image";
  if (pos == 2) type = "audio";
  ArrayList<Parameters> arrayList = new ArrayList<Parameters>();
  arrayList.add(new Parameters("action", "search"));
  arrayList.add(new Parameters("keywords", new String(searchView.getQuery().toString()).trim()));
  arrayList.add(new Parameters("pagesize", PAGE_SIZE + ""));
  arrayList.add(new Parameters("type", type));
  new RequestingTask(this, "正在搜索", Constants.domain + "/services/pkuhole/api.php",
      Constants.REQUEST_HOLE_SEARCH).execute(arrayList);
}

代码示例来源:origin: TeamWalrus/Walrus

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
  Card card;
  String filter = sv.getQuery().toString();
  if (!filter.isEmpty()) {
    List<Card> cards = QueryUtils.filterCards(getHelper().getCardDao(), filter);
    card = cards.get(position);
  } else {
    card = QueryUtils.getNthRow(getHelper().getCardDao(), position);
  }
  ((WalrusCardView) ((FrameLayout) holder.itemView).getChildAt(0)).setCard(card);
  holder.id = card.id;
  ViewCompat.setTransitionName(holder.itemView, "card-" + card.id);
}

代码示例来源:origin: stackoverflow.com

protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  mSearchString = mSearchView.getQuery().toString();
  outState.putString(SEARCH_KEY, mSearchString);

相关文章