Loading src/com/android/settings/search/SearchResultsAdapter.java +18 −16 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> implements SearchResultsRankerCallback { Loading Loading @@ -312,8 +313,8 @@ public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> int appSize = installedAppResults.size(); final List<SearchResult> asyncRankingResults = new ArrayList<>(dbSize + appSize); List<SearchResult> databaseResultsSortedByScores = new ArrayList<>(databaseResults); Collections.sort(databaseResultsSortedByScores, new Comparator<SearchResult>() { TreeSet<SearchResult> dbResultsSortedByScores = new TreeSet<>( new Comparator<SearchResult>() { @Override public int compare(SearchResult o1, SearchResult o2) { float score1 = getRankingScoreByStableId(o1.stableId); Loading @@ -327,7 +328,8 @@ public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> } } }); asyncRankingResults.addAll(databaseResultsSortedByScores); dbResultsSortedByScores.addAll(databaseResults); asyncRankingResults.addAll(dbResultsSortedByScores); // App results are not ranked by async ranking and appended at the end of the list. asyncRankingResults.addAll(installedAppResults); return asyncRankingResults; Loading Loading
src/com/android/settings/search/SearchResultsAdapter.java +18 −16 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> implements SearchResultsRankerCallback { Loading Loading @@ -312,8 +313,8 @@ public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> int appSize = installedAppResults.size(); final List<SearchResult> asyncRankingResults = new ArrayList<>(dbSize + appSize); List<SearchResult> databaseResultsSortedByScores = new ArrayList<>(databaseResults); Collections.sort(databaseResultsSortedByScores, new Comparator<SearchResult>() { TreeSet<SearchResult> dbResultsSortedByScores = new TreeSet<>( new Comparator<SearchResult>() { @Override public int compare(SearchResult o1, SearchResult o2) { float score1 = getRankingScoreByStableId(o1.stableId); Loading @@ -327,7 +328,8 @@ public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> } } }); asyncRankingResults.addAll(databaseResultsSortedByScores); dbResultsSortedByScores.addAll(databaseResults); asyncRankingResults.addAll(dbResultsSortedByScores); // App results are not ranked by async ranking and appended at the end of the list. asyncRankingResults.addAll(installedAppResults); return asyncRankingResults; Loading