Bug 1391413: Show 2 lines of top sites titles for distributions. r=sebastian draft
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 11 Sep 2017 13:27:54 -0700
changeset 662541 10381d6ee029b6e54a5d8fdddf7960515635b688
parent 661134 c8767e78adc54e00fef97a1a968c3a187c3d8e18
child 730903 f7d123f44e8adc8239af29108d0a07717d3be625
push id79119
push usermichael.l.comella@gmail.com
push dateMon, 11 Sep 2017 20:28:17 +0000
reviewerssebastian
bugs1391413
milestone57.0a1
Bug 1391413: Show 2 lines of top sites titles for distributions. r=sebastian MozReview-Commit-ID: JcW22s8oDMG
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/topsites/TopSitesCard.java
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/topsites/TopSitesCard.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/topsites/TopSitesCard.java
@@ -121,16 +121,22 @@ import java.util.concurrent.Future;
             topSiteURI = new URI(topSite.getUrl());
         } catch (final URISyntaxException e) {
             wasException = true;
         }
 
         final boolean isSiteSuggestedFromDistribution = BrowserDB.from(itemView.getContext()).getSuggestedSites()
                 .containsSiteAndSiteIsFromDistribution(topSite.getUrl());
 
+        // Some already installed distributions are unlikely to be updated (OTA, system) and their suggested
+        // site titles were written for the old top sites, where we had more room to display titles: we want
+        // to provide them with more lines. However, it's complex to distinguish a distribution intended for
+        // the old top sites and the new one so for code simplicity, we allow all distributions more lines for titles.
+        title.setMaxLines(isSiteSuggestedFromDistribution ? 2 : 1);
+
         // At a high level, the logic is: if the path non-empty or the site is suggested by a distribution, use the page
         // title, otherwise use "subdomain.domain". From a UX perspective, people refer to domains by their name ("it's
         // on wikipedia") and it's a clean look. However, if a url has a path, it will not fit on the screen with the
         // domain so we need an alternative: the page title is an easy win (though not always perfect, e.g. when SEO
         // keywords are added). We use page titles with distributions because that's what those distributions expect to
         // be shown. If we ever want better top site titles, we could create a heuristic to pull the title from parts
         // of the URL, page title, etc.
         if (wasException ||