Skip to content

Commit

Permalink
Show number of results in search screen
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Oct 19, 2023
1 parent b427ee4 commit b5fa94e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ val EnTwineStrings =
searchSortNewestFirst = "Newest first",
searchSortOldest = "Oldest",
searchSortOldestFirst = "Oldest first",
searchResultsCount = { count ->
when (count) {
1 -> "$count result"
else -> "$count results"
}
},
bookmark = "Bookmark",
bookmarks = "Bookmarks",
settings = "Settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ data class TwineStrings(
val searchSortNewestFirst: String,
val searchSortOldest: String,
val searchSortOldestFirst: String,
val searchResultsCount: (Int) -> String,
val bookmark: String,
val bookmarks: String,
val settings: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import app.cash.paging.compose.collectAsLazyPagingItems
import dev.sasikanth.rss.reader.components.DropdownMenu
import dev.sasikanth.rss.reader.components.DropdownMenuItem
import dev.sasikanth.rss.reader.components.ScrollToTopButton
import dev.sasikanth.rss.reader.components.SubHeader
import dev.sasikanth.rss.reader.home.ui.PostListItem
import dev.sasikanth.rss.reader.platform.LocalLinkHandler
import dev.sasikanth.rss.reader.resources.icons.Sort
Expand Down Expand Up @@ -120,6 +121,15 @@ internal fun SearchScreen(searchPresenter: SearchPresenter, modifier: Modifier =
),
state = listState
) {
if (searchResults.itemCount > 0) {
item {
SubHeader(
text = LocalStrings.current.searchResultsCount(searchResults.itemCount),
modifier = Modifier.padding(top = 8.dp)
)
}
}

items(count = searchResults.itemCount) { index ->
val post = searchResults[index]
if (post != null) {
Expand Down

0 comments on commit b5fa94e

Please sign in to comment.