Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java |
index 0624b075476305ed97efb1a6b3e881e8dc4beb88..0e7551a6a46acfa3d1dc80c6870e67dac44e5529 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java |
@@ -254,6 +254,7 @@ public class SnippetArticleViewHolder extends CardViewHolder implements Impressi |
boolean showThumbnail = shouldShowThumbnail(horizontalStyle, verticalStyle, layout); |
mHeadlineTextView.setVisibility(showHeadline ? View.VISIBLE : View.GONE); |
+ mHeadlineTextView.setMaxLines(getHeaderMaxLines(horizontalStyle, verticalStyle, layout)); |
mArticleSnippetTextView.setVisibility(showDescription ? View.VISIBLE : View.GONE); |
mThumbnailView.setVisibility(showThumbnail ? View.VISIBLE : View.GONE); |
@@ -306,6 +307,14 @@ public class SnippetArticleViewHolder extends CardViewHolder implements Impressi |
return true; |
} |
+ /** |
+ * If no summary (no description) is shown, allow more lines for the header (title). |
+ * @return The maximum number of header text lines. |
+ */ |
+ private int getHeaderMaxLines(int horizontalStyle, int verticalStyle, int layout) { |
+ return shouldShowDescription(horizontalStyle, verticalStyle, layout) ? 2 : 3; |
+ } |
+ |
private static String getPublisherString(SnippetArticle article) { |
// We format the publisher here so that having a publisher name in an RTL language |
// doesn't mess up the formatting on an LTR device and vice versa. |