Search in sources :

Example 1 with SearchCriteria

use of org.moire.ultrasonic.domain.SearchCriteria in project ultrasonic by ultrasonic.

the class SearchActivity method search.

private void search(final String query, final boolean autoplay) {
    final int maxArtists = Util.getMaxArtists(this);
    final int maxAlbums = Util.getMaxAlbums(this);
    final int maxSongs = Util.getMaxSongs(this);
    BackgroundTask<SearchResult> task = new TabActivityBackgroundTask<SearchResult>(this, true) {

        @Override
        protected SearchResult doInBackground() throws Throwable {
            SearchCriteria criteria = new SearchCriteria(query, maxArtists, maxAlbums, maxSongs);
            MusicService service = MusicServiceFactory.getMusicService(SearchActivity.this);
            licenseValid = service.isLicenseValid(SearchActivity.this, this);
            return service.search(criteria, SearchActivity.this, this);
        }

        @Override
        protected void done(SearchResult result) {
            searchResult = result;
            populateList();
            if (autoplay) {
                autoplay();
            }
        }
    };
    task.execute();
}
Also used : TabActivityBackgroundTask(org.moire.ultrasonic.util.TabActivityBackgroundTask) MusicService(org.moire.ultrasonic.service.MusicService) SearchResult(org.moire.ultrasonic.domain.SearchResult) SearchCriteria(org.moire.ultrasonic.domain.SearchCriteria)

Aggregations

SearchCriteria (org.moire.ultrasonic.domain.SearchCriteria)1 SearchResult (org.moire.ultrasonic.domain.SearchResult)1 MusicService (org.moire.ultrasonic.service.MusicService)1 TabActivityBackgroundTask (org.moire.ultrasonic.util.TabActivityBackgroundTask)1