/** * Enter/exit search mode. This is method is tightly related to the current query, and should * only be called by {@link #setQueryString}. * * Also note this method doesn't call {@link #reloadData()}; {@link #setQueryString} does it. */ protected void setSearchMode(boolean flag) { if (mSearchMode != flag) { mSearchMode = flag; setSectionHeaderDisplayEnabled(!mSearchMode); if (!flag) { mDirectoryListStatus = STATUS_NOT_LOADED; getLoaderManager().destroyLoader(DIRECTORY_LOADER_ID); } if (mAdapter != null) { mAdapter.setSearchMode(flag); mAdapter.clearPartitions(); if (!flag) { // If we are switching from search to regular display, remove all directory // partitions after default one, assuming they are remote directories which // should be cleaned up on exiting the search mode. mAdapter.removeDirectoriesAfterDefault(); } mAdapter.configureDefaultPartition(false, flag); } if (mListView != null) { mListView.setFastScrollEnabled(!flag); } } }