Commit 77c7838b authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Allow Entity suggestions to omit description line.

Regular rich entity suggestions come with a description line (eg actor, movie etc), but
Local entity suggestions may not include this detail, generating an odd-looking suggestion
that reserves space for a line that is never filled in (eg. Starbucks).

Bug: 1025342
Change-Id: Iff2d4ba7150deb0b29ccf4f4961f8eccb379615a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919733
Commit-Queue: Ender <ender@google.com>
Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718862}
parent a1d9516a
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.BlackBody" android:textAppearance="@style/TextAppearance.BlackBody"
android:maxLines="1" android:maxLines="1"
android:visibility="gone"
android:ellipsize="end" android:ellipsize="end"
android:textAlignment="viewStart" /> android:textAlignment="viewStart" />
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.omnibox.suggestions.entity; package org.chromium.chrome.browser.omnibox.suggestions.entity;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.chrome.R; import org.chromium.chrome.R;
...@@ -20,11 +22,17 @@ public class EntitySuggestionViewBinder extends BaseSuggestionViewBinder { ...@@ -20,11 +22,17 @@ public class EntitySuggestionViewBinder extends BaseSuggestionViewBinder {
super.bind(model, view, propertyKey); super.bind(model, view, propertyKey);
if (EntitySuggestionViewProperties.SUBJECT_TEXT == propertyKey) { if (EntitySuggestionViewProperties.SUBJECT_TEXT == propertyKey) {
TextView tv = view.findContentView(R.id.entity_subject); final TextView tv = view.findContentView(R.id.entity_subject);
tv.setText(model.get(EntitySuggestionViewProperties.SUBJECT_TEXT)); tv.setText(model.get(EntitySuggestionViewProperties.SUBJECT_TEXT));
} else if (EntitySuggestionViewProperties.DESCRIPTION_TEXT == propertyKey) { } else if (EntitySuggestionViewProperties.DESCRIPTION_TEXT == propertyKey) {
TextView tv = view.findContentView(R.id.entity_description); final TextView tv = view.findContentView(R.id.entity_description);
tv.setText(model.get(EntitySuggestionViewProperties.DESCRIPTION_TEXT)); final String text = model.get(EntitySuggestionViewProperties.DESCRIPTION_TEXT);
if (TextUtils.isEmpty(text)) {
tv.setVisibility(View.GONE);
} else {
tv.setVisibility(View.VISIBLE);
tv.setText(model.get(EntitySuggestionViewProperties.DESCRIPTION_TEXT));
}
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment