use of com.frostwire.android.gui.adapters.SearchResultListAdapter.FilteredSearchResults in project frostwire by frostwire.
the class SearchFragment method refreshFileTypeCounters.
private void refreshFileTypeCounters(boolean fileTypeCountersVisible) {
searchInput.setFileTypeCountersVisible(fileTypeCountersVisible);
boolean keywordFiltersApplied = adapter.getKeywordFiltersPipeline().size() > 0;
FilteredSearchResults fsr = fileTypeCounter.fsr;
int applications = keywordFiltersApplied ? fsr.numFilteredApplications : fsr.numApplications;
int audios = keywordFiltersApplied ? fsr.numFilteredAudio : fsr.numAudio;
int documents = keywordFiltersApplied ? fsr.numFilteredDocuments : fsr.numDocuments;
int pictures = keywordFiltersApplied ? fsr.numFilteredPictures : fsr.numPictures;
int torrents = keywordFiltersApplied ? fsr.numFilteredTorrents : fsr.numTorrents;
int videos = keywordFiltersApplied ? fsr.numFilteredVideo : fsr.numVideo;
searchInput.updateFileTypeCounter(Constants.FILE_TYPE_APPLICATIONS, applications);
searchInput.updateFileTypeCounter(Constants.FILE_TYPE_AUDIO, audios);
searchInput.updateFileTypeCounter(Constants.FILE_TYPE_DOCUMENTS, documents);
searchInput.updateFileTypeCounter(Constants.FILE_TYPE_PICTURES, pictures);
searchInput.updateFileTypeCounter(Constants.FILE_TYPE_TORRENTS, torrents);
searchInput.updateFileTypeCounter(Constants.FILE_TYPE_VIDEOS, videos);
}
use of com.frostwire.android.gui.adapters.SearchResultListAdapter.FilteredSearchResults in project frostwire by frostwire.
the class SearchFragment method onSearchResults.
private void onSearchResults(final List<SearchResult> results) {
FilteredSearchResults fsr = adapter.filter(results);
final List<SearchResult> mediaTypeFiltered = fsr.filtered;
final List<SearchResult> keywordFiltered = fsr.keywordFiltered;
fileTypeCounter.add(fsr);
// if it's a fresh search, make sure to clear keyword detector
if (adapter.getCount() == 0 && adapter.getKeywordFiltersPipeline().size() == 0) {
resetKeywordDetector();
}
if (adapter.getKeywordFiltersPipeline().isEmpty()) {
updateKeywordDetector(results);
} else {
updateKeywordDetector(keywordFiltered);
}
if (isAdded()) {
getActivity().runOnUiThread(() -> {
adapter.addResults(keywordFiltered, mediaTypeFiltered);
showSearchView(getView());
refreshFileTypeCounters(true);
});
}
}
Aggregations