LicenseHtmlGeneratorFromXml, LicenseHtmlLoader and indirecly AsyncLoader shoud be commonly used by Settings and TvSettings. So this CL will move them to SettingsLib. Test: building succeeded and tested on sailfish. make ROBOTEST_FILTER=SettingsLicenseActivityTest RunSettingsRoboTests Change-Id: I12e9169b1d3d313a6c5da0d575a6526327268381
31 lines
773 B
Java
31 lines
773 B
Java
package com.android.settings.search;
|
|
|
|
import com.android.settingslib.utils.AsyncLoader;
|
|
|
|
import android.content.Context;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Loads a sorted list of Search results for a given query.
|
|
*/
|
|
public class SearchResultLoader extends AsyncLoader<List<? extends SearchResult>> {
|
|
|
|
private final String mQuery;
|
|
|
|
public SearchResultLoader(Context context, String query) {
|
|
super(context);
|
|
mQuery = query;
|
|
}
|
|
|
|
@Override
|
|
public List<? extends SearchResult> loadInBackground() {
|
|
SearchResultAggregator aggregator = SearchResultAggregator.getInstance();
|
|
return aggregator.fetchResults(getContext(), mQuery);
|
|
}
|
|
|
|
@Override
|
|
protected void onDiscardResult(List<? extends SearchResult> result) {
|
|
}
|
|
}
|