Merge pull request #790 from MrCustomizer/#784_firstEntryNotMarkedAsRead

#784: Fix first entry not marked as read after sync
This commit is contained in:
David Luhmer 2019-09-26 21:46:54 +02:00 committed by GitHub
commit 27b52f3bed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -281,6 +281,7 @@ public class NewsReaderDetailFragment extends Fragment {
}
void loadRssItemsIntoView(List<RssItem> rssItems) {
previousFirstVisibleItem = -1;
try {
NewsListRecyclerAdapter nra = ((NewsListRecyclerAdapter) recyclerView.getAdapter());
if (nra == null) {
@ -537,6 +538,9 @@ public class NewsReaderDetailFragment extends Fragment {
loadRssItemsIntoView(rssItem);
if (rssItem.size() < 10) { // Less than 10 items in the list (usually 3-5 items fit on one screen)
// There is no API to check, if this listener has already been added. We don't want to
// add it multiple times, so we take the safe route here by removing it before adding it.
recyclerView.removeOnItemTouchListener(itemTouchListener);
recyclerView.addOnItemTouchListener(itemTouchListener);
} else {
recyclerView.removeOnItemTouchListener(itemTouchListener);