Fix incorrect result breadcrumbs am: d1b08e7149 am: df3b80e4bf
Change-Id: Ic572e9ba034c4eab71d1ce5c97157a9acc655255
diff --git a/src/com/android/settings/intelligence/search/car/CarIntentSearchViewHolder.java b/src/com/android/settings/intelligence/search/car/CarIntentSearchViewHolder.java
index ba8a165..bc3ef60 100644
--- a/src/com/android/settings/intelligence/search/car/CarIntentSearchViewHolder.java
+++ b/src/com/android/settings/intelligence/search/car/CarIntentSearchViewHolder.java
@@ -19,6 +19,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -49,15 +50,7 @@
} else {
mIcon.setImageDrawable(result.icon);
}
- if (result.breadcrumbs != null && !result.breadcrumbs.isEmpty()) {
- String breadcrumb = result.breadcrumbs.get(0);
- int count = result.breadcrumbs.size();
- for (int i = 1; i < count; i++) {
- breadcrumb = mContext.getString(R.string.search_breadcrumb_connector,
- breadcrumb, result.breadcrumbs.get(i));
- }
- mSummary.setText(breadcrumb);
- }
+ bindBreadcrumbView(result);
itemView.setOnClickListener(v -> {
fragment.onSearchResultClicked(/* resultViewHolder= */ this, result);
@@ -77,4 +70,23 @@
}
});
}
+
+ private void bindBreadcrumbView(SearchResult result) {
+ if (result.breadcrumbs == null || result.breadcrumbs.isEmpty()) {
+ mSummary.setVisibility(View.GONE);
+ return;
+ }
+ String breadcrumb = result.breadcrumbs.get(0);
+ int count = result.breadcrumbs.size();
+ for (int i = 1; i < count; i++) {
+ breadcrumb = mContext.getString(R.string.search_breadcrumb_connector,
+ breadcrumb, result.breadcrumbs.get(i));
+ }
+ if (breadcrumb == null || TextUtils.isEmpty(breadcrumb.trim())) {
+ mSummary.setVisibility(View.GONE);
+ } else {
+ mSummary.setText(breadcrumb);
+ mSummary.setVisibility(View.VISIBLE);
+ }
+ }
}