Skip to content

Commit 8292503

Browse files
authored
Merge branch 'jetcaster/all_form_factors' into jetcaster/all_form_factors
2 parents ebe87ca + c3a5252 commit 8292503

File tree

70 files changed

+2203
-911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2203
-911
lines changed

Jetcaster/README.md

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Jetcaster sample 🎙️
44

55
Jetcaster is a sample podcast app, built with [Jetpack Compose][compose]. The goal of the sample is to
6-
showcase dynamic theming and full featured architecture.
6+
showcase building with Compose across multiple form factors and full featured architecture.
77

88
To try out this sample app, use the latest stable version
99
of [Android Studio](https://developer.android.com/studio).
@@ -14,7 +14,7 @@ project from Android Studio following the steps
1414
### Status: 🚧 In progress 🚧
1515

1616
Jetcaster is still in the early stages of development, and as such only one screen has been created so far. However,
17-
most of the app's architecture has been implemented, as well as the data layer, and early stages of dynamic theming.
17+
most of the app's architecture has been implemented as well as the data layer.
1818

1919

2020
## Screenshots
@@ -36,29 +36,6 @@ The player screen layout is adapting to different form factors, including a tabl
3636

3737
<img src="docs/tabletop.png"/>
3838

39-
### Dynamic theming
40-
The home screen currently implements dynamic theming, using the artwork of the currently selected podcast from the carousel to update the `primary` and `onPrimary` [colors](https://developer.android.com/reference/kotlin/androidx/compose/material/Colors). You can see it in action in the screenshots above: as the carousel item is changed, the background gradient is updated to match the artwork.
41-
42-
This is implemented in [`DynamicTheming.kt`](app/src/main/java/com/example/jetcaster/util/DynamicTheming.kt), which provides the `DynamicThemePrimaryColorsFromImage` composable, to automatically animate the theme colors based on the provided image URL, like so:
43-
44-
``` kotlin
45-
val dominantColorState: DominantColorState = rememberDominantColorState()
46-
47-
DynamicThemePrimaryColorsFromImage(dominantColorState) {
48-
var imageUrl = remember { mutableStateOf("") }
49-
50-
// When the image url changes, call updateColorsFromImageUrl()
51-
launchInComposition(imageUrl) {
52-
dominantColorState.updateColorsFromImageUrl(imageUrl)
53-
}
54-
55-
// Content which will be dynamically themed....
56-
}
57-
```
58-
59-
Underneath, [`DominantColorState`](app/src/main/java/com/example/jetcaster/util/DynamicTheming.kt) uses the [Coil][coil] library to fetch the artwork image 🖼️, and then [Palette][palette] to extract the dominant colors from the image 🎨.
60-
61-
6239
### Others
6340
Some other notable things which are implemented:
6441

Jetcaster/app/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ dependencies {
100100
implementation(libs.androidx.constraintlayout.compose)
101101

102102
implementation(libs.androidx.compose.foundation)
103-
implementation(libs.androidx.compose.material)
104103
implementation(libs.androidx.compose.material3)
105-
implementation(libs.androidx.compose.materialWindow)
104+
implementation(libs.androidx.compose.material3.window)
106105
implementation(libs.androidx.compose.material.iconsExtended)
107106
implementation(libs.androidx.compose.ui.tooling.preview)
108107
debugImplementation(libs.androidx.compose.ui.tooling)

Jetcaster/app/src/main/java/com/example/jetcaster/ui/JetcasterApp.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package com.example.jetcaster.ui
1818

19-
import androidx.compose.material.AlertDialog
20-
import androidx.compose.material.Text
21-
import androidx.compose.material.TextButton
19+
import androidx.compose.material3.AlertDialog
20+
import androidx.compose.material3.Text
21+
import androidx.compose.material3.TextButton
2222
import androidx.compose.material3.windowsizeclass.WindowSizeClass
2323
import androidx.compose.runtime.Composable
2424
import androidx.compose.ui.res.stringResource

Jetcaster/app/src/main/java/com/example/jetcaster/ui/MainActivity.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
package com.example.jetcaster.ui
1818

19-
import android.graphics.Color
2019
import android.os.Bundle
2120
import androidx.activity.ComponentActivity
22-
import androidx.activity.SystemBarStyle
2321
import androidx.activity.compose.setContent
2422
import androidx.activity.enableEdgeToEdge
2523
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
@@ -32,10 +30,7 @@ class MainActivity : ComponentActivity() {
3230
override fun onCreate(savedInstanceState: Bundle?) {
3331
super.onCreate(savedInstanceState)
3432

35-
enableEdgeToEdge(
36-
// This app is only ever in dark mode, so hard code detectDarkMode to true.
37-
SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT, detectDarkMode = { true })
38-
)
33+
enableEdgeToEdge()
3934

4035
setContent {
4136
val windowSizeClass = calculateWindowSizeClass(this)

0 commit comments

Comments
 (0)