Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.foundation.lazy.grid.items
Expand Down Expand Up @@ -54,33 +53,6 @@ import com.example.jetcaster.ui.theme.JetcasterTheme
import com.example.jetcaster.util.ToggleFollowPodcastIconButton
import com.example.jetcaster.util.fullWidthItem

fun LazyListScope.podcastCategory(
podcastCategoryFilterResult: PodcastCategoryFilterResult,
navigateToPodcastDetails: (PodcastInfo) -> Unit,
navigateToPlayer: (EpisodeInfo) -> Unit,
onQueueEpisode: (PlayerEpisode) -> Unit,
onTogglePodcastFollowed: (PodcastInfo) -> Unit,
) {
item {
CategoryPodcasts(
topPodcasts = podcastCategoryFilterResult.topPodcasts,
navigateToPodcastDetails = navigateToPodcastDetails,
onTogglePodcastFollowed = onTogglePodcastFollowed
)
}

val episodes = podcastCategoryFilterResult.episodes
items(episodes, key = { it.episode.uri }) { item ->
EpisodeListItem(
episode = item.episode,
podcast = item.podcast,
onClick = navigateToPlayer,
onQueueEpisode = onQueueEpisode,
modifier = Modifier.fillParentMaxWidth()
)
}
}

fun LazyGridScope.podcastCategory(
podcastCategoryFilterResult: PodcastCategoryFilterResult,
navigateToPodcastDetails: (PodcastInfo) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.foundation.lazy.itemsIndexed
Expand Down Expand Up @@ -49,41 +48,6 @@ import com.example.jetcaster.designsystem.theme.Keyline1
import com.example.jetcaster.ui.home.category.podcastCategory
import com.example.jetcaster.util.fullWidthItem

fun LazyListScope.discoverItems(
filterableCategoriesModel: FilterableCategoriesModel,
podcastCategoryFilterResult: PodcastCategoryFilterResult,
navigateToPodcastDetails: (PodcastInfo) -> Unit,
navigateToPlayer: (EpisodeInfo) -> Unit,
onCategorySelected: (CategoryInfo) -> Unit,
onTogglePodcastFollowed: (PodcastInfo) -> Unit,
onQueueEpisode: (PlayerEpisode) -> Unit,
) {
if (filterableCategoriesModel.isEmpty) {
// TODO: empty state
return
}

item {
Spacer(Modifier.height(8.dp))

PodcastCategoryTabs(
filterableCategoriesModel = filterableCategoriesModel,
onCategorySelected = onCategorySelected,
modifier = Modifier.fillMaxWidth()
)

Spacer(Modifier.height(8.dp))
}

podcastCategory(
podcastCategoryFilterResult = podcastCategoryFilterResult,
navigateToPodcastDetails = navigateToPodcastDetails,
navigateToPlayer = navigateToPlayer,
onTogglePodcastFollowed = onTogglePodcastFollowed,
onQueueEpisode = onQueueEpisode,
)
}

fun LazyGridScope.discoverItems(
filterableCategoriesModel: FilterableCategoriesModel,
podcastCategoryFilterResult: PodcastCategoryFilterResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ package com.example.jetcaster.ui.home.library

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
Expand All @@ -35,36 +33,6 @@ import com.example.jetcaster.designsystem.theme.Keyline1
import com.example.jetcaster.ui.shared.EpisodeListItem
import com.example.jetcaster.util.fullWidthItem

fun LazyListScope.libraryItems(
library: LibraryInfo,
navigateToPlayer: (EpisodeInfo) -> Unit,
onQueueEpisode: (PlayerEpisode) -> Unit
) {
item {
Text(
text = stringResource(id = R.string.latest_episodes),
modifier = Modifier.padding(
start = Keyline1,
top = 16.dp,
),
style = MaterialTheme.typography.titleLarge,
)
}

items(
library,
key = { it.episode.uri }
) { item ->
EpisodeListItem(
episode = item.episode,
podcast = item.podcast,
onClick = navigateToPlayer,
onQueueEpisode = onQueueEpisode,
modifier = Modifier.fillParentMaxWidth(),
)
}
}

fun LazyGridScope.libraryItems(
library: LibraryInfo,
navigateToPlayer: (EpisodeInfo) -> Unit,
Expand Down