Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4269)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java

Issue 1924463002: Align suggestion text with icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't offset unless second line has image Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
index d9e3df05bb46b6083eeed03734f2870ebf7dbae1..7ee2c78785e6103e6ee6a5f1ac35bf0c6acadcdf 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
@@ -61,8 +61,10 @@ class SuggestionView extends ViewGroup {
private static final int TITLE_COLOR_STANDARD_FONT_LIGHT = 0xFFFFFFFF;
private static final int URL_COLOR = 0xFF5595FE;
+ private static final int ANSWER_LINE2_VERTICAL_SPACING_DP = 3;
+ private static final int ANSWER_IMAGE_VERTICAL_SPACING_DP =
+ ANSWER_LINE2_VERTICAL_SPACING_DP + 2;
private static final int ANSWER_IMAGE_HORIZONTAL_SPACING_DP = 4;
- private static final int ANSWER_IMAGE_VERTICAL_SPACING_DP = 5;
private static final float ANSWER_IMAGE_SCALING_FACTOR = 1.15f;
private LocationBar mLocationBar;
@@ -726,8 +728,14 @@ class SuggestionView extends ViewGroup {
} else {
// The text lines fit comfortably, so vertically center them.
verticalOffset = (height - line1Height - line2Height) / 2;
- if (child == mTextLine2) verticalOffset += line1Height;
-
+ if (child == mTextLine2) {
+ verticalOffset += line1Height;
+ if (mSuggestion.hasAnswer()
+ && mSuggestion.getAnswer().getSecondLine().hasImage()) {
+ verticalOffset += ANSWER_LINE2_VERTICAL_SPACING_DP
+ * getResources().getDisplayMetrics().density;
+ }
+ }
// When one line is larger than the other, it contains extra vertical padding. This
// produces more apparent whitespace above or below the text lines. Add a small
// offset to compensate.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698