Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jetcaster] UI polish of TV module and resolved navigation & focus traversal issue in player screen #1481

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun HtmlTextContainer(
text: String,
content: @Composable (AnnotatedString) -> Unit
) {
val annotatedString = remember(key1 = text) {
val annotatedString = remember(text) {
AnnotatedString.fromHtml(htmlString = text)
}
SelectionContainer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private fun WidgetAsyncImage(
val context = LocalContext.current
val scope = rememberCoroutineScope()

LaunchedEffect(key1 = uri) {
LaunchedEffect(uri) {
val request = ImageRequest.Builder(context)
.data(uri)
.size(200, 200)
Expand Down
34 changes: 17 additions & 17 deletions Jetcaster/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,56 @@
#####
[versions]
accompanist = "0.36.0"
androidGradlePlugin = "8.7.2"
androidGradlePlugin = "8.7.3"
androidx-activity-compose = "1.9.3"
androidx-appcompat = "1.7.0"
androidx-benchmark = "1.2.4"
androidx-benchmark-junit4 = "1.2.4"
androidx-compose-bom = "2024.10.01"
androidx-constraintlayout = "1.1.0-alpha13"
androidx-benchmark = "1.3.3"
androidx-benchmark-junit4 = "1.3.3"
androidx-compose-bom = "2024.12.01"
androidx-constraintlayout = "1.1.0"
androidx-core-splashscreen = "1.0.1"
androidx-corektx = "1.15.0"
androidx-glance = "1.1.0"
androidx-glance = "1.1.1"
androidx-lifecycle = "2.8.2"
androidx-lifecycle-compose = "2.8.7"
androidx-lifecycle-runtime-compose = "2.8.7"
androidx-navigation = "2.8.3"
androidx-navigation = "2.8.5"
androidx-palette = "1.0.0"
androidx-test = "1.6.1"
androidx-test-espresso = "3.6.1"
androidx-test-ext-junit = "1.2.1"
androidx-test-ext-truth = "1.5.0"
androidx-test-ext-truth = "1.6.0"
androidx-tv-foundation = "1.0.0-alpha11"
androidx-tv-material = "1.0.0"
androidx-wear-compose = "1.3.1"
androidx-wear-compose = "1.4.0"
androidx-window = "1.3.0"
androidxHiltNavigationCompose = "1.2.0"
androix-test-uiautomator = "2.3.0"
coil = "2.6.0"
coil = "2.7.0"
# @keep
compileSdk = "35"
coroutines = "1.9.0"
google-maps = "18.2.0"
google-maps = "19.0.0"
gradle-versions = "0.51.0"
hilt = "2.51.1"
hiltExt = "1.2.0"
horologist = "0.6.19"
# @pin When updating to AGP 7.4.0-alpha10 and up we can update this https://developer.android.com/studio/write/java8-support#library-desugaring-versions
jdkDesugar = "1.2.2"
jdkDesugar = "2.1.3"
junit = "4.13.2"
kotlin = "2.0.21"
kotlin = "2.1.0"
kotlinx-serialization-json = "1.7.3"
kotlinx_immutable = "0.3.8"
ksp = "2.0.20-1.0.24"
maps-compose = "3.1.1"
# @keep
minSdk = "21"
okhttp = "4.11.0"
play-services-wearable = "18.1.0"
okhttp = "4.12.0"
play-services-wearable = "19.0.0"
robolectric = "4.13"
roborazzi = "1.12.0"
roborazzi = "1.26.0"
rome = "1.18.0"
room = "2.6.0"
room = "2.6.1"
secrets = "2.0.1"
# @keep
targetSdk = "33"
Expand Down
2 changes: 1 addition & 1 deletion Jetcaster/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ private fun HomeScreen(
modifier: Modifier = Modifier
) {
// Effect that changes the home category selection when there are no subscribed podcasts
LaunchedEffect(key1 = featuredPodcasts) {
LaunchedEffect(featuredPodcasts) {
if (featuredPodcasts.isEmpty()) {
onHomeAction(HomeAction.HomeCategorySelected(HomeCategory.Discover))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private fun Background(
) {
ImageBackgroundRadialGradientScrim(
url = imageUrl,
colors = listOf(Color.Black, Color.Transparent),
colors = listOf(Color(0xE0000000), Color(0xB0000000)),
modifier = modifier,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.example.jetcaster.tv.ui.component

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
Expand All @@ -36,10 +37,10 @@ internal fun ButtonWithIcon(
modifier: Modifier = Modifier,
scale: ButtonScale = ButtonDefaults.scale(),
) {
Button(onClick = onClick, modifier = modifier, scale = scale) {
Button(onClick = onClick, contentPadding = PaddingValues(start = 6.dp, end = 16.dp), modifier = modifier, scale = scale) {
Icon(
icon,
contentDescription = null,
contentDescription = null
)
Spacer(modifier = Modifier.width(6.dp))
Text(text = label)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.example.jetcaster.tv.ui.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand All @@ -30,9 +31,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.tv.material3.Border
import androidx.tv.material3.Card
import androidx.tv.material3.CardDefaults
import androidx.tv.material3.CardScale
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import androidx.tv.material3.WideCardContainer
Expand Down Expand Up @@ -72,8 +73,18 @@ private fun EpisodeThumbnail(
Card(
onClick = onClick,
interactionSource = interactionSource,
scale = CardScale.None,
scale = CardDefaults.scale(scale = 0.85f, focusedScale = 1.0f),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scaling is intentionally disabled. We should keep the original intention.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel the previous behavior accurately reflects our design best practices to clearly indicate focus, because the card is very large and it's easy to overlook the outline. The added padding has compensated for the scaling elsewhere.

shape = CardDefaults.shape(RoundedCornerShape(12.dp)),
border = CardDefaults.border(
focusedBorder = Border(
border = BorderStroke(
3.dp,
color = MaterialTheme.colorScheme.border
),
inset = 3.dp,
shape = RoundedCornerShape(15.dp)
)
),
modifier = modifier,
) {
Thumbnail(episode = playerEpisode, size = JetcasterAppDefaults.thumbnailSize.episode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal fun EpisodeDataAndDuration(
offsetDateTime: OffsetDateTime,
duration: Duration,
modifier: Modifier = Modifier,
style: TextStyle = MaterialTheme.typography.bodySmall,
style: TextStyle = MaterialTheme.typography.bodyMedium,
) {
Text(
text = stringResource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

package com.example.jetcaster.tv.ui.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.tv.material3.Border
import androidx.tv.material3.Card
import androidx.tv.material3.CardDefaults
import androidx.tv.material3.CardScale
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.StandardCardContainer
import androidx.tv.material3.Text
import com.example.jetcaster.core.model.PodcastInfo
Expand All @@ -40,8 +42,18 @@ internal fun PodcastCard(
Card(
onClick = onClick,
interactionSource = it,
scale = CardScale.None,
shape = CardDefaults.shape(RoundedCornerShape(12.dp))
scale = CardDefaults.scale(scale = 0.9f, focusedScale = 1.0f),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scaling is intentionally disabled. Would you keep the original code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thoughts as the comment in EpisodeCard.

shape = CardDefaults.shape(RoundedCornerShape(16.dp)),
border = CardDefaults.border(
focusedBorder = Border(
border = BorderStroke(
3.dp,
color = MaterialTheme.colorScheme.border
),
inset = 3.dp,
shape = RoundedCornerShape(19.dp)
),
)
) {
Thumbnail(
podcastInfo = podcastInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ fun DiscoverScreen(
private fun CatalogWithCategorySelection(
categoryInfoList: CategoryInfoList,
podcastList: PodcastList,

selectedCategory: CategoryInfo,
latestEpisodeList: EpisodeList,
onPodcastSelected: (PodcastInfo) -> Unit,
Expand Down
Loading
Loading