Bug 1543058 - Display all pinned top sites even with identical base URLs; r=VladBaicu

Differential Revision: https://phabricator.services.mozilla.com/D27872

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Petru Lingurar 2019-04-17 10:00:31 +00:00
Родитель e669ece2f8
Коммит 4b4898f15e
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -122,7 +122,8 @@ public class TopPanelRow extends StreamViewHolder {
final Set<String> urls = new HashSet<String>(limit);
do {
String baseUrl = getBaseForUrl(cursor.getString(cursor.getColumnIndex(BrowserContract.Combined.URL)));
if (!urls.contains(baseUrl)) {
boolean isPinned = isTopSitePinned(cursor.getInt(cursor.getColumnIndex(BrowserContract.TopSites.TYPE)));
if (isPinned || !urls.contains(baseUrl)) {
final Object[] originalColumns = new Object[] {
cursor.getLong(cursor.getColumnIndex(BrowserContract.Combined._ID)),
cursor.getLong(cursor.getColumnIndex(BrowserContract.Combined.BOOKMARK_ID)),
@ -142,6 +143,10 @@ public class TopPanelRow extends StreamViewHolder {
return filteredCursor;
}
private boolean isTopSitePinned(final int topSiteType) {
return topSiteType == BrowserContract.TopSites.TYPE_PINNED;
}
private String getBaseForUrl(final String url) {
try {
return new URL(url).getHost();