Sync search result loaders
The loaders should be syncronized so the results can be properly ranked without sudden insertions. This means InstalledAppsLoader needs to finish faster, which is accomplished by delaying icon loading to bind time rather than as the apps are queried. Bug: 34772522 Test: make RunSettingsRoboTests Change-Id: I7f5244c574d37c6cfd8bbd0d3d40488f38211be3
This commit is contained in:
@@ -26,6 +26,12 @@ import java.util.Objects;
|
||||
*/
|
||||
public class SearchResult implements Comparable<SearchResult> {
|
||||
|
||||
/**
|
||||
* Defines the max rank for a search result to be considered as ranked. Results with ranks
|
||||
* higher than this have no guarantee for sorting order.
|
||||
*/
|
||||
public static final int MAX_RANK = 9;
|
||||
|
||||
/**
|
||||
* The title of the result and main text displayed.
|
||||
* Intent Results: Displays as the primary
|
||||
@@ -74,7 +80,7 @@ public class SearchResult implements Comparable<SearchResult> {
|
||||
*/
|
||||
public final long stableId;
|
||||
|
||||
private SearchResult(Builder builder) {
|
||||
protected SearchResult(Builder builder) {
|
||||
title = builder.mTitle;
|
||||
summary = builder.mSummary;
|
||||
breadcrumbs = builder.mBreadcrumbs;
|
||||
@@ -116,19 +122,19 @@ public class SearchResult implements Comparable<SearchResult> {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addRank(int rank) {
|
||||
public Builder addRank(int rank) {
|
||||
if (rank >= 0 && rank <= 9) {
|
||||
mRank = rank;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addIcon(Drawable icon) {
|
||||
public Builder addIcon(Drawable icon) {
|
||||
mIcon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addPayload(ResultPayload payload) {
|
||||
public Builder addPayload(ResultPayload payload) {
|
||||
mResultPayload = payload;
|
||||
return this;
|
||||
}
|
||||
@@ -143,4 +149,4 @@ public class SearchResult implements Comparable<SearchResult> {
|
||||
return new SearchResult(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user