private List<QuranRow> getBookmarkRows(BookmarkData data, boolean groupByTags) { List<QuranRow> rows; List<Tag> tags = data.getTags(); List<Bookmark> bookmarks = data.getBookmarks(); if (groupByTags) { rows = getRowsSortedByTags(tags, bookmarks); } else { rows = getSortedRows(bookmarks); } int lastPage = mQuranSettings.getLastPage(); boolean showLastPage = lastPage != Constants.NO_PAGE_SAVED; if (showLastPage && (lastPage > Constants.PAGES_LAST || lastPage < Constants.PAGES_FIRST)) { showLastPage = false; Timber.w("Got invalid last saved page as %d", lastPage); } if (showLastPage) { rows.add(0, QuranRowFactory.fromCurrentPageHeader(mAppContext)); rows.add(1, QuranRowFactory.fromCurrentPage(mAppContext, lastPage)); } return rows; }