fun loadFeed(feed: FeedCollection) {
if(feed.itemStateMode > 0 && feed.unreadItemsCount > 0) {
- feed.unreadItemsCount = 0
+ // Only reset the unread counter if the feed is not already opened
+ // This is necessary to have a reliable counter in the sourcelist after a sync job finishes
+ if(feed != currentFeed) {
+ feed.unreadItemsCount = 0
+ }
GlobalScope.launch(Dispatchers.IO) {
Database.updateFeedReadState(feed, true)
}
feed?.let {
println("feed: ${feed.name}")
feedList.loadFeed(feed)
- sourceList.feeds.update()
+ // mode 1: mark all items as read when opening the feed
+ // update the sourcelist to remove the unread counter badge from this feed
+ if(feed.itemStateMode == 1) {
+ sourceList.groups[evt.sublistIndex].feeds.update(evt.rowIndex)
+ }
}
} catch (e: Exception) {
e.printStackTrace()