Leverage the behavior of showing the searching message in wifi slice

Fixes: 124823973
Test: robotest
Change-Id: Id89ec5ef09f05f83e019a6f4488cacf2ab4e635b
This commit is contained in:
Jason Chiu
2019-02-26 18:01:00 +08:00
parent cabe72cf7b
commit 6bbe6e2362
3 changed files with 149 additions and 5 deletions

View File

@@ -118,10 +118,19 @@ public class WifiSlice implements CustomSliceable {
final SliceBackgroundWorker worker = SliceBackgroundWorker.getInstance(getUri());
final List<AccessPoint> results = worker != null ? worker.getResults() : null;
final int apCount = results == null ? 0 : results.size();
// Need a loading text when results are not ready.
boolean needLoadingRow = results == null;
final int apCount = needLoadingRow ? 0 : results.size();
// Need a loading text when results are not ready or out of date.
boolean needLoadingRow = true;
int index = apCount > 0 && results.get(0).isActive() ? 1 : 0;
// This loop checks the existence of reachable APs to determine the validity of the current
// AP list.
for (; index < apCount; index++) {
if (results.get(index).isReachable()) {
needLoadingRow = false;
break;
}
}
// Add AP rows
final CharSequence placeholder = mContext.getText(R.string.summary_placeholder);