Bug 1391413: Show 2 lines of top sites titles for distributions. r=sebastian
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 11 Sep 2017 13:27:54 -0700
changeset 429915 4a0a1836410d762c9eb2b0f0dbd0fbd0ffa18918
parent 429914 6f9e8b34fc59fc5707b67a8e435505c8b3204796
child 429916 ec61b7a902c2b09a1e7cf6ef9c7eeb46f658368c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1391413
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 ||