Skip to content

[Jetcaster] Handling of HTML Elements in PodcastSummary on Foldable Devices #1339

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

Merged
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
8 changes: 4 additions & 4 deletions Crane/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ androidx-activity-compose = "1.8.2"
androidx-appcompat = "1.6.1"
androidx-benchmark = "1.2.0"
androidx-benchmark-junit4 = "1.2.1"
androidx-compose-bom = "2024.03.00"
androidx-compose-bom = "2024.04.00"
androidx-constraintlayout = "1.0.1"
androidx-corektx = "1.13.0-beta01"
androidx-corektx = "1.13.0-rc01"
androidx-glance = "1.0.0"
androidx-lifecycle-compose = "2.7.0"
androidx-lifecycle-runtime-compose = "2.7.0"
Expand All @@ -21,7 +21,7 @@ androidx-test = "1.5.0"
androidx-test-espresso = "3.5.1"
androidx-test-ext-junit = "1.1.5"
androidx-test-ext-truth = "1.5.0"
androidx-window = "1.3.0-alpha03"
androidx-window = "1.3.0-beta01"
androidxHiltNavigationCompose = "1.1.0"
androix-test-uiautomator = "2.2.0"
coil = "2.4.0"
Expand All @@ -45,7 +45,7 @@ material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
robolectric = "4.11.1"
robolectric = "4.12.1"
rome = "1.18.0"
room = "2.6.0"
secrets = "2.0.1"
Expand Down
8 changes: 4 additions & 4 deletions JetLagged/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ androidx-activity-compose = "1.8.2"
androidx-appcompat = "1.6.1"
androidx-benchmark = "1.2.0"
androidx-benchmark-junit4 = "1.2.1"
androidx-compose-bom = "2024.03.00"
androidx-compose-bom = "2024.04.00"
androidx-constraintlayout = "1.0.1"
androidx-corektx = "1.13.0-beta01"
androidx-corektx = "1.13.0-rc01"
androidx-glance = "1.0.0"
androidx-lifecycle-compose = "2.7.0"
androidx-lifecycle-runtime-compose = "2.7.0"
Expand All @@ -21,7 +21,7 @@ androidx-test = "1.5.0"
androidx-test-espresso = "3.5.1"
androidx-test-ext-junit = "1.1.5"
androidx-test-ext-truth = "1.5.0"
androidx-window = "1.3.0-alpha03"
androidx-window = "1.3.0-beta01"
androidxHiltNavigationCompose = "1.1.0"
androix-test-uiautomator = "2.2.0"
coil = "2.4.0"
Expand All @@ -45,7 +45,7 @@ material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
robolectric = "4.11.1"
robolectric = "4.12.1"
rome = "1.18.0"
room = "2.6.0"
secrets = "2.0.1"
Expand Down
8 changes: 4 additions & 4 deletions JetNews/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ androidx-activity-compose = "1.8.2"
androidx-appcompat = "1.6.1"
androidx-benchmark = "1.2.0"
androidx-benchmark-junit4 = "1.2.1"
androidx-compose-bom = "2024.03.00"
androidx-compose-bom = "2024.04.00"
androidx-constraintlayout = "1.0.1"
androidx-corektx = "1.13.0-beta01"
androidx-corektx = "1.13.0-rc01"
androidx-glance = "1.0.0"
androidx-lifecycle-compose = "2.7.0"
androidx-lifecycle-runtime-compose = "2.7.0"
Expand All @@ -21,7 +21,7 @@ androidx-test = "1.5.0"
androidx-test-espresso = "3.5.1"
androidx-test-ext-junit = "1.1.5"
androidx-test-ext-truth = "1.5.0"
androidx-window = "1.3.0-alpha03"
androidx-window = "1.3.0-beta01"
androidxHiltNavigationCompose = "1.1.0"
androix-test-uiautomator = "2.2.0"
coil = "2.4.0"
Expand All @@ -45,7 +45,7 @@ material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
robolectric = "4.11.1"
robolectric = "4.12.1"
rome = "1.18.0"
room = "2.6.0"
secrets = "2.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,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.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.lazy.LazyColumn
Expand Down Expand Up @@ -386,10 +384,7 @@ private fun HomeScreen(
val coroutineScope = rememberCoroutineScope()
val snackbarHostState = remember { SnackbarHostState() }
HomeScreenBackground(
modifier = modifier
.windowInsetsPadding(
WindowInsets.systemBars.only(WindowInsetsSides.Horizontal)
)
modifier = modifier.windowInsetsPadding(WindowInsets.navigationBars)
) {
Scaffold(
topBar = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
Expand All @@ -55,6 +56,7 @@ import androidx.compose.material.icons.rounded.PlayCircleFilled
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Slider
import androidx.compose.material3.Surface
Expand All @@ -73,11 +75,13 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.core.text.HtmlCompat
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.window.core.layout.WindowSizeClass
import androidx.window.core.layout.WindowWidthSizeClass
Expand Down Expand Up @@ -486,19 +490,16 @@ private fun PlayerContentBookStart(
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(
vertical = 8.dp,
vertical = 40.dp,
horizontal = 16.dp
),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceAround
) {
Spacer(modifier = Modifier.height(32.dp))
PodcastInformation(
episode.title,
episode.podcastName,
episode.summary
title = episode.title,
name = episode.podcastName,
summary = episode.summary,
)
Spacer(modifier = Modifier.height(32.dp))
}
}

Expand Down Expand Up @@ -618,32 +619,32 @@ private fun PodcastInformation(
title: String,
name: String,
summary: String,
modifier: Modifier = Modifier,
titleTextStyle: TextStyle = MaterialTheme.typography.headlineSmall,
nameTextStyle: TextStyle = MaterialTheme.typography.displaySmall,
) {
Column(
modifier = modifier.padding(horizontal = 8.dp),
verticalArrangement = Arrangement.spacedBy(32.dp),
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(horizontal = 8.dp)
) {
Text(
text = name,
style = nameTextStyle,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.height(32.dp))
Text(
text = title,
style = titleTextStyle,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.height(32.dp))
Text(
HtmlText(
text = summary,
style = MaterialTheme.typography.bodyMedium,
color = LocalContentColor.current
)
Spacer(modifier = Modifier.weight(1f))
}
}

Expand Down Expand Up @@ -776,6 +777,25 @@ private fun FullScreenLoading(modifier: Modifier = Modifier) {
}
}

@Composable
private fun HtmlText(
text: String,
style: TextStyle,
color: Color
) {
val annotationString = buildAnnotatedString {
val htmlCompat = HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_COMPACT)
append(htmlCompat)
}
SelectionContainer {
Text(
text = annotationString,
style = style,
color = color
)
}
}

@Preview
@Composable
fun TopAppBarPreview() {
Expand Down
8 changes: 4 additions & 4 deletions Jetcaster/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ androidx-activity-compose = "1.8.2"
androidx-appcompat = "1.6.1"
androidx-benchmark = "1.2.3"
androidx-benchmark-junit4 = "1.2.3"
androidx-compose-bom = "2024.03.00"
androidx-compose-bom = "2024.04.00"
androidx-compose-material3-adaptive = "1.0.0-alpha10"
androidx-constraintlayout = "1.0.1"
androidx-corektx = "1.13.0-beta01"
androidx-corektx = "1.13.0-rc01"
androidx-glance = "1.0.0"
androidx-lifecycle-runtime = "2.7.0"
androidx-lifecycle-compose = "2.7.0"
Expand All @@ -25,7 +25,7 @@ androidx-test-ext-junit = "1.1.5"
androidx-test-ext-truth = "1.5.0"
androidx-tv-foundation = "1.0.0-alpha10"
androidx-tv-material = "1.0.0-alpha10"
androidx-window = "1.3.0-alpha03"
androidx-window = "1.3.0-beta01"
androidxHiltNavigationCompose = "1.2.0"
androix-test-uiautomator = "2.3.0"
coil = "2.5.0"
Expand All @@ -49,7 +49,7 @@ material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.12.0"
robolectric = "4.11.1"
robolectric = "4.12.1"
rome = "1.18.0"
room = "2.6.1"
secrets = "2.0.1"
Expand Down
8 changes: 4 additions & 4 deletions Jetchat/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ androidx-activity-compose = "1.8.2"
androidx-appcompat = "1.6.1"
androidx-benchmark = "1.2.0"
androidx-benchmark-junit4 = "1.2.1"
androidx-compose-bom = "2024.03.00"
androidx-compose-bom = "2024.04.00"
androidx-constraintlayout = "1.0.1"
androidx-corektx = "1.13.0-beta01"
androidx-corektx = "1.13.0-rc01"
androidx-glance = "1.0.0"
androidx-lifecycle-compose = "2.7.0"
androidx-lifecycle-runtime-compose = "2.7.0"
Expand All @@ -21,7 +21,7 @@ androidx-test = "1.5.0"
androidx-test-espresso = "3.5.1"
androidx-test-ext-junit = "1.1.5"
androidx-test-ext-truth = "1.5.0"
androidx-window = "1.3.0-alpha03"
androidx-window = "1.3.0-beta01"
androidxHiltNavigationCompose = "1.1.0"
androix-test-uiautomator = "2.2.0"
coil = "2.4.0"
Expand All @@ -45,7 +45,7 @@ material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
robolectric = "4.11.1"
robolectric = "4.12.1"
rome = "1.18.0"
room = "2.6.0"
secrets = "2.0.1"
Expand Down
1 change: 1 addition & 0 deletions Jetsnack/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,5 @@ dependencies {
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(libs.androidx.compose.ui.test)
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import com.example.jetsnack.ui.JetsnackApp
import com.example.jetsnack.ui.MainActivity
import org.junit.Before
import org.junit.Rule
import org.junit.Test

Expand All @@ -31,13 +29,6 @@ class AppTest {
@get:Rule
val composeTestRule = createAndroidComposeRule<MainActivity>()

@Before
fun setUp() {
composeTestRule.setContent {
JetsnackApp()
}
}

@Test
fun app_launches() {
// Check app launches at the correct destination
Expand Down
Loading