Ejemplo n.º 1
0
  public void filter(String searchTerm) {
    AwesomeBarCursorAdapter adapter = getCursorAdapter();
    adapter.filter(searchTerm);

    filterSuggestions(searchTerm);
    if (mSuggestionsOptInPrompt != null) {
      int visibility = TextUtils.isEmpty(searchTerm) ? View.GONE : View.VISIBLE;
      if (mSuggestionsOptInPrompt.getVisibility() != visibility) {
        mSuggestionsOptInPrompt.setVisibility(visibility);
      }
    }
  }
Ejemplo n.º 2
0
  public void filter(String searchTerm) {
    // Don't let the tab's content steal focus on tab switch
    setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    // Ensure the 'All Pages' tab is selected
    setCurrentTabByTag(ALL_PAGES_TAB);

    // Restore normal focus behavior on tab host
    setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);

    // The tabs should only be visible if there's no on-going search
    int tabsVisibility = (searchTerm.length() == 0 ? View.VISIBLE : View.GONE);
    getTabWidget().setVisibility(tabsVisibility);

    // Perform the actual search
    mAllPagesCursorAdapter.filter(searchTerm);
  }