Bug 1391413: Show 2 lines of top sites titles for distributions. r=sebastian
MozReview-Commit-ID: JcW22s8oDMG
--- 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 ||