Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion Jetcaster/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ androidx-appcompat = "1.7.1"
androidx-compose-bom = "2025.09.00"
androidx-constraintlayout = "1.1.1"
androidx-core-splashscreen = "1.0.1"
androidx-corektx = "1.16.0"
androidx-corektx = "1.17.0"
androidx-glance = "1.1.1"
androidx-lifecycle = "2.8.2"
androidx-lifecycle-compose = "2.9.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.example.jetcaster.ui
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.core.view.WindowCompat
import com.example.jetcaster.glancewidget.updateWidgetPreview
import com.example.jetcaster.ui.theme.JetcasterTheme
import com.google.accompanist.adaptive.calculateDisplayFeatures
Expand All @@ -30,7 +30,7 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

enableEdgeToEdge()
WindowCompat.enableEdgeToEdge(window)
updateWidgetPreview(this)
setContent {
val displayFeatures = calculateDisplayFeatures(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.windowInsetsPadding
Expand Down Expand Up @@ -84,6 +86,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
Expand Down Expand Up @@ -393,9 +396,7 @@ private fun HomeScreen(

val coroutineScope = rememberCoroutineScope()
val snackbarHostState = remember { SnackbarHostState() }
HomeScreenBackground(
modifier = modifier.windowInsetsPadding(WindowInsets.navigationBars),
) {
HomeScreenBackground {
Scaffold(
topBar = {
Column {
Expand All @@ -418,6 +419,7 @@ private fun HomeScreen(
containerColor = Color.Transparent,
) { contentPadding ->
// Main Content
val layoutDirection = LocalLayoutDirection.current
val snackBarText = stringResource(id = R.string.episode_added_to_your_queue)
val showHomeCategoryTabs = featuredPodcasts.isNotEmpty() && homeCategories.isNotEmpty()
HomeContent(
Expand All @@ -426,7 +428,19 @@ private fun HomeScreen(
filterableCategoriesModel = filterableCategoriesModel,
podcastCategoryFilterResult = podcastCategoryFilterResult,
library = library,
modifier = Modifier.padding(contentPadding),
/**
* Edge-to-edge:
* Handles start, end and top insets allowing content to scroll behind the system navigation bar for an edge-to-edge look.
* Bottom insets are applied to the last list item in [HomeContentGrid].
*/
modifier = modifier.padding(
PaddingValues(
start = contentPadding.calculateLeftPadding(layoutDirection),
end = contentPadding.calculateRightPadding(layoutDirection),
top = contentPadding.calculateTopPadding(),
bottom = 0.dp,
)
),
onHomeAction = { action ->
if (action is HomeAction.QueueEpisode) {
coroutineScope.launch {
Expand Down Expand Up @@ -454,7 +468,7 @@ private fun HomeScreen(
@Composable
fun PillToolbar(selectedHomeCategory: HomeCategory, onHomeAction: (HomeAction) -> Unit, modifier: Modifier = Modifier) {
HorizontalFloatingToolbar(
modifier = modifier,
modifier = modifier.navigationBarsPadding(),
colors = FloatingToolbarColors(
toolbarContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
toolbarContentColor = MaterialTheme.colorScheme.onSurfaceVariant,
Expand Down Expand Up @@ -585,6 +599,12 @@ private fun HomeContentGrid(
LazyVerticalGrid(
columns = GridCells.Adaptive(362.dp),
modifier = modifier.fillMaxSize(),
/**
* Edge-to-edge:
* Allows content to scroll behind the system navigation bar while ensuring the last list item is still accessible.
* Top, start and end insets are handled in [HomeScreen].
*/
contentPadding = WindowInsets.navigationBars.asPaddingValues()
) {
when (selectedHomeCategory) {
HomeCategory.Library -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
Expand Down Expand Up @@ -167,7 +166,7 @@ private fun PlayerScreen(
SnackbarHost(hostState = snackbarHostState)
},
modifier = modifier,
) { contentPadding ->
) { _ ->
if (uiState.episodePlayerState.currentEpisode != null) {
PlayerContentWithBackground(
uiState = uiState,
Expand All @@ -181,7 +180,6 @@ private fun PlayerScreen(
onAddToQueue()
},
playerControlActions = playerControlActions,
contentPadding = contentPadding,
)
} else {
FullScreenLoading()
Expand All @@ -207,14 +205,11 @@ fun PlayerContentWithBackground(
onAddToQueue: () -> Unit,
playerControlActions: PlayerControlActions,
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(0.dp),
) {
Box(modifier = modifier, contentAlignment = Alignment.Center) {
Box(contentAlignment = Alignment.Center) {
PlayerBackground(
episode = uiState.episodePlayerState.currentEpisode,
modifier = Modifier
.fillMaxSize()
.padding(contentPadding),
modifier = modifier.fillMaxSize()
)
PlayerContent(
uiState = uiState,
Expand Down
Loading