f.feedcollection_id,
f.name as feed_name,
f.update_interval,
- f.auto_mark_read
+ f.auto_mark_read,
+ c.unread_count
from groups g
left join feedcollections f on g.group_id = f.group_id
+ left join (select feedcollection_id, count(*) as unread_count from items I inner join feeds F on I.feed_id = F.feed_id
+ where I.is_read = false group by feedcollection_id) C on f.feedcollection_id = C.feedcollection_id
order by g.pos, f.pos
""".trimIndent())
val feedName = rs.getString("feed_name")
val updateInterval = rs.getLong("update_interval")
val autoMarkRead = rs.getBoolean("auto_mark_read")
+ val unreadCount = rs.getInt("unread_count")
if(currentGroup == null || currentGroup.id != groupId) {
currentGroup = FeedGroup(context, groupId, groupName)
val feed = FeedCollection(feedId, feedName)
feed.updateInterval = updateInterval
feed.autoMarkRead = autoMarkRead
+ feed.unreadItemsCount = unreadCount
currentGroup.feeds.add(feed)
}
{ elm: FeedCollection ->
val item = SubListItem()
item.label = elm.name
+ if(elm.unreadItemsCount > 0) {
+ item.badge = elm.unreadItemsCount.toString()
+ }
item
}
hbox(margin = 4, spacing = 4) {
}
feedList.items.selected?.let {
feedList.selectItem(it)
+ sourceList.feeds.update()
}
},
getstyle = { elm, col, style ->
// only highlight unread items if the feed(collection) is configured
// to have individual read states
if(feedList.currentFeed?.autoMarkRead == false) {
- println("yes")
// col == -1: style for the entire row
// highlight unread items
if(col == -1 && !elm.isRead) {