Bug 1553474 - "Remove bookmark" option is displayed for pages that were not bookmarked; r=petru

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
diana.iacos 2019-05-27 07:43:43 +00:00
Родитель 7fe82142c4
Коммит 15ff313e56
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -126,7 +126,7 @@ public class TopPanelRow extends StreamViewHolder {
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)),
getBookmarkId(cursor),
cursor.getLong(cursor.getColumnIndex(BrowserContract.Combined.HISTORY_ID)),
cursor.getString(cursor.getColumnIndex(BrowserContract.Combined.URL)),
cursor.getString(cursor.getColumnIndex(BrowserContract.Combined.TITLE)),
@ -143,6 +143,12 @@ public class TopPanelRow extends StreamViewHolder {
return filteredCursor;
}
private Long getBookmarkId(Cursor cursor) {
// If the value of BOOKMARK_ID column it's null that means the url is not bookmarked
final int columnIndex = cursor.getColumnIndex(BrowserContract.Combined.BOOKMARK_ID);
return cursor.isNull(columnIndex) ? null : cursor.getLong(columnIndex);
}
private boolean isTopSitePinned(final int topSiteType) {
return topSiteType == BrowserContract.TopSites.TYPE_PINNED;
}