1 package com.android.settings.intelligence.search;
2 
3 
4 import android.content.Context;
5 
6 import com.android.settings.intelligence.utils.AsyncLoader;
7 
8 import java.util.List;
9 
10 /**
11  * Loads a sorted list of Search results for a given query.
12  */
13 public class SearchResultLoader extends AsyncLoader<List<? extends SearchResult>> {
14 
15     private final String mQuery;
16 
SearchResultLoader(Context context, String query)17     public SearchResultLoader(Context context, String query) {
18         super(context);
19         mQuery = query;
20     }
21 
22     @Override
loadInBackground()23     public List<? extends SearchResult> loadInBackground() {
24         SearchResultAggregator aggregator = SearchResultAggregator.getInstance();
25         return aggregator.fetchResults(getContext(), mQuery);
26     }
27 
28     @Override
onDiscardResult(List<? extends SearchResult> result)29     protected void onDiscardResult(List<? extends SearchResult> result) {
30     }
31 }
32