From 69788de077220914eab44f7ba4a9daeb8fb29d71 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Sun, 14 Jan 2024 01:01:45 +0100 Subject: [PATCH] Show feeds without folders in FeedTab --- .../com/readrops/app/compose/feeds/FeedTab.kt | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/appcompose/src/main/java/com/readrops/app/compose/feeds/FeedTab.kt b/appcompose/src/main/java/com/readrops/app/compose/feeds/FeedTab.kt index 0f21a765..e8fdd996 100644 --- a/appcompose/src/main/java/com/readrops/app/compose/feeds/FeedTab.kt +++ b/appcompose/src/main/java/com/readrops/app/compose/feeds/FeedTab.kt @@ -114,20 +114,35 @@ object FeedTab : Tab { items( items = foldersAndFeeds.toList() ) { folderWithFeeds -> + + fun onFeedClick(feed: Feed) { + selectedFeed = feed + selectedFolder = folderWithFeeds.first + showBottomSheet = true + } + + fun onFeedLongClick(feed: Feed) { + haptic.performHapticFeedback(HapticFeedbackType.LongPress) + uriHandler.openUri(feed.siteUrl!!) + } + if (folderWithFeeds.first != null) { FolderExpandableItem( folder = folderWithFeeds.first!!, feeds = folderWithFeeds.second, - onFeedClick = { feed -> - selectedFeed = feed - selectedFolder = folderWithFeeds.first - showBottomSheet = true - }, - onFeedLongClick = { feed -> - haptic.performHapticFeedback(HapticFeedbackType.LongPress) - uriHandler.openUri(feed.siteUrl!!) - } + onFeedClick = { feed -> onFeedClick(feed) }, + onFeedLongClick = { feed -> onFeedLongClick(feed) } ) + } else { + val feeds = folderWithFeeds.second + + for (feed in feeds) { + FeedItem( + feed = feed, + onClick = { onFeedClick(feed) }, + onLongClick = { onFeedLongClick(feed) }, + ) + } } } }