Search in sources :

Example 1 with FilteredSearchResults

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);
}
Also used : FilteredSearchResults(com.frostwire.android.gui.adapters.SearchResultListAdapter.FilteredSearchResults)

Example 2 with FilteredSearchResults

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);
        });
    }
}
Also used : FilteredSearchResults(com.frostwire.android.gui.adapters.SearchResultListAdapter.FilteredSearchResults) TorrentCrawledSearchResult(com.frostwire.search.torrent.TorrentCrawledSearchResult) HttpSearchResult(com.frostwire.search.HttpSearchResult) TorrentSearchResult(com.frostwire.search.torrent.TorrentSearchResult) FileSearchResult(com.frostwire.search.FileSearchResult) AbstractTorrentSearchResult(com.frostwire.search.torrent.AbstractTorrentSearchResult) TorrentPromotionSearchResult(com.frostwire.frostclick.TorrentPromotionSearchResult) HttpSlideSearchResult(com.frostwire.android.gui.transfers.HttpSlideSearchResult) SearchResult(com.frostwire.search.SearchResult) YouTubeSearchResult(com.frostwire.search.youtube.YouTubeSearchResult)

Aggregations

FilteredSearchResults (com.frostwire.android.gui.adapters.SearchResultListAdapter.FilteredSearchResults)2 HttpSlideSearchResult (com.frostwire.android.gui.transfers.HttpSlideSearchResult)1 TorrentPromotionSearchResult (com.frostwire.frostclick.TorrentPromotionSearchResult)1 FileSearchResult (com.frostwire.search.FileSearchResult)1 HttpSearchResult (com.frostwire.search.HttpSearchResult)1 SearchResult (com.frostwire.search.SearchResult)1 AbstractTorrentSearchResult (com.frostwire.search.torrent.AbstractTorrentSearchResult)1 TorrentCrawledSearchResult (com.frostwire.search.torrent.TorrentCrawledSearchResult)1 TorrentSearchResult (com.frostwire.search.torrent.TorrentSearchResult)1 YouTubeSearchResult (com.frostwire.search.youtube.YouTubeSearchResult)1