Commit 6e690dc7 authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Control both minHeight and padding attributes for Compact suggestions.

This change fixes bug introduced in https://crrev.com/c/2079298.
Android views include view paddings when computing view size (both
height and width), resulting in the padding being accounted for when
comparing the resulting dimensions against minimum dimension hints.

As an effect, the view becomes much more compact than originally
intended.

Bug: 1050813

Change-Id: Icffff1a6bbd4c4608fc77f25a4ba0c9708431835
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083921Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Ender <ender@google.com>
Cr-Commit-Position: refs/heads/master@{#746198}
parent 2369d194
......@@ -7,8 +7,7 @@
android:id="@+id/omnibox_answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minHeight="@dimen/omnibox_suggestion_height">
android:orientation="vertical">
<TextView
android:id="@+id/omnibox_answer_line_1"
......
......@@ -6,7 +6,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/omnibox_suggestion_height"
android:gravity="center"
android:orientation="vertical">
......
......@@ -7,8 +7,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:minHeight="@dimen/omnibox_suggestion_height">
android:orientation="vertical">
<TextView
android:id="@+id/entity_subject"
......
......@@ -311,7 +311,8 @@
<dimen name="start_surface_toolbar_button_padding_to_edge">16dp</dimen>
<!-- Omnibox suggestions -->
<dimen name="omnibox_suggestion_height">40dp</dimen>
<dimen name="omnibox_suggestion_comfortable_height">60dp</dimen>
<dimen name="omnibox_suggestion_compact_height">52dp</dimen>
<dimen name="omnibox_suggestion_comfortable_padding">10dp</dimen>
<dimen name="omnibox_suggestion_compact_padding">6dp</dimen>
<dimen name="omnibox_suggestion_list_padding_bottom">8dp</dimen>
......
......@@ -130,6 +130,11 @@ public final class BaseSuggestionViewBinder<T extends View>
? R.dimen.omnibox_suggestion_compact_padding
: R.dimen.omnibox_suggestion_comfortable_padding);
view.getContentView().setPaddingRelative(0, verticalPad, 0, verticalPad);
final int minimumHeight = view.getResources().getDimensionPixelSize(isCompact
? R.dimen.omnibox_suggestion_compact_height
: R.dimen.omnibox_suggestion_comfortable_height);
view.getContentView().setMinimumHeight(minimumHeight);
}
/** Update image view using supplied drawable state object. */
......
......@@ -22,7 +22,6 @@ public class TailSuggestionView extends TextView {
public TailSuggestionView(Context context, AttributeSet attrs) {
super(context, attrs);
setMinimumHeight(getResources().getDimensionPixelSize(R.dimen.omnibox_suggestion_height));
setGravity(Gravity.CENTER_VERTICAL);
setMaxLines(1);
ApiCompatibilityUtils.setTextAppearance(this, R.style.TextAppearance_TextLarge_Primary);
......
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