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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleViewHolder.java

Issue 2939723003: Allow 3 lines for suggestion headers when summaries are not shown. (Closed)
Patch Set: Created 3 years, 6 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 | « chrome/android/java/res/layout/new_tab_page_snippets_card.xml ('k') | 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/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.
« no previous file with comments | « chrome/android/java/res/layout/new_tab_page_snippets_card.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698