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

Jetsnack - Migrate to Material 3 #1437

Merged
merged 29 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bbb6e7a
Migrate to using Material 3 as the underlying theming system for Jets…
riggaroo Aug 1, 2024
fc4e98e
Fix filters screen to also come in with shared element transition.
riggaroo Aug 2, 2024
bcb9f9c
Merge branch 'jetsnack/shared-element' into jetsnack/m3
riggaroo Aug 2, 2024
b3d14fc
Polish up the jetsnack sample to look better.
riggaroo Aug 6, 2024
48f7eec
Polish up the jetsnack sample to look better.
riggaroo Aug 6, 2024
8d321d5
Fix insets.
riggaroo Aug 6, 2024
07866b6
Fix animation of Destination bar
riggaroo Aug 6, 2024
7703263
Merge branch 'compose-latest' into jetsnack/m3
riggaroo Aug 8, 2024
d1e4589
Update to remove Material 2 from dependencies
riggaroo Aug 9, 2024
7bf234c
fix formatting
riggaroo Aug 9, 2024
9f8b5e5
Formatting
riggaroo Aug 9, 2024
d66341e
Formatting
riggaroo Aug 9, 2024
56ecfcc
Formatting
riggaroo Aug 9, 2024
677ac78
Formatting
riggaroo Aug 9, 2024
09dfbb8
🤖 Apply Spotless
riggaroo Aug 9, 2024
3565077
Fix previews and icons
riggaroo Aug 9, 2024
e488f71
Merge branch 'jetsnack/m3' of https://github.com/android/compose-samp…
riggaroo Aug 9, 2024
ed3fa5e
Fix formatting
riggaroo Aug 9, 2024
d94481b
🤖 Apply Spotless
riggaroo Aug 9, 2024
7ee7824
Removed Rtl mirroring function in favour of AutoMirror icons
riggaroo Aug 9, 2024
83ff22a
Merge branch 'jetsnack/m3' of https://github.com/android/compose-samp…
riggaroo Aug 9, 2024
925e847
🤖 Apply Spotless
riggaroo Aug 9, 2024
1ef9bf1
Remove experimental annotation
riggaroo Aug 9, 2024
9ff6650
Fix swipe to dismiss background to use progress instead of dp
riggaroo Aug 12, 2024
f42c4b5
🤖 Apply Spotless
riggaroo Aug 12, 2024
941fe60
Code cleanup
riggaroo Aug 12, 2024
5d06366
🤖 Apply Spotless
riggaroo Aug 12, 2024
502e188
Cleanup workflows
riggaroo Aug 12, 2024
9ea3eba
remove emulator cache for jetnews
riggaroo Aug 12, 2024
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
1 change: 0 additions & 1 deletion JetLagged/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.constraintlayout.compose)
implementation(libs.google.android.material)

implementation(libs.androidx.compose.runtime)
implementation(libs.androidx.compose.foundation)
Expand Down
2 changes: 1 addition & 1 deletion JetLagged/app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
the License.
-->
<resources>
<style name="Theme.JetLagged" parent="Theme.MaterialComponents.DayNight"/>
<style name="Theme.JetLagged" parent="android:Theme.Material.Light.NoActionBar"/>
</resources>
3 changes: 0 additions & 3 deletions JetLagged/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ kotlin = "2.0.0"
kotlinx_immutable = "0.3.7"
ksp = "2.0.0-1.0.21"
maps-compose = "3.1.1"
material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
Expand Down Expand Up @@ -78,7 +77,6 @@ androidx-compose-animation = { module = "androidx.compose.animation:animation",
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-latest"}
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" ,version.ref = "androidx-compose-latest"}
androidx-compose-material = { module = "androidx.compose.material:material" }
androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-material3-adaptive = { module = "androidx.compose.material3.adaptive:adaptive", version.ref = "androidx-compose-material3-adaptive" }
Expand Down Expand Up @@ -138,7 +136,6 @@ androidx-window-core = { module = "androidx.window:window-core", version.ref = "
coil-kt-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
core-jdk-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "jdkDesugar" }
dagger-hiltandroidplugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
google-android-material = { module = "com.google.android.material:material", version.ref = "material" }
googlemaps-compose = { module = "com.google.maps.android:maps-compose", version.ref = "maps-compose" }
googlemaps-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "google-maps" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
Expand Down
2 changes: 0 additions & 2 deletions JetNews/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ dependencies {
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.window)

implementation(libs.google.android.material)

androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.runner)
Expand Down
3 changes: 0 additions & 3 deletions JetNews/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ kotlin = "2.0.0"
kotlinx_immutable = "0.3.7"
ksp = "2.0.0-1.0.21"
maps-compose = "3.1.1"
material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
Expand Down Expand Up @@ -78,7 +77,6 @@ androidx-compose-animation = { module = "androidx.compose.animation:animation",
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-latest"}
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" ,version.ref = "androidx-compose-latest"}
androidx-compose-material = { module = "androidx.compose.material:material" }
androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-material3-adaptive = { module = "androidx.compose.material3.adaptive:adaptive", version.ref = "androidx-compose-material3-adaptive" }
Expand Down Expand Up @@ -138,7 +136,6 @@ androidx-window-core = { module = "androidx.window:window-core", version.ref = "
coil-kt-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
core-jdk-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "jdkDesugar" }
dagger-hiltandroidplugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
google-android-material = { module = "com.google.android.material:material", version.ref = "material" }
googlemaps-compose = { module = "com.google.maps.android:maps-compose", version.ref = "maps-compose" }
googlemaps-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "google-maps" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/core/data-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}

kotlin {
jvmToolchain(17)
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(projects.core.data)
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}

kotlin {
jvmToolchain(17)
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}

kotlin {
jvmToolchain(17)
}
composeCompiler {
enableStrongSkippingMode = true
}
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/core/domain-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}

kotlin {
jvmToolchain(17)
}
dependencies {
implementation(projects.core.domain)

Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/core/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}

kotlin {
jvmToolchain(17)
}
dependencies {
coreLibraryDesugaring(libs.core.jdk.desugaring)
implementation(projects.core.data)
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/glancewidget/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ android {
}
}
}

kotlin {
jvmToolchain(17)
}
composeCompiler {
enableStrongSkippingMode = true
}
Expand Down
3 changes: 0 additions & 3 deletions Jetcaster/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ kotlin = "2.0.0"
kotlinx_immutable = "0.3.7"
ksp = "2.0.0-1.0.21"
maps-compose = "3.1.1"
material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
Expand Down Expand Up @@ -78,7 +77,6 @@ androidx-compose-animation = { module = "androidx.compose.animation:animation",
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-latest"}
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" ,version.ref = "androidx-compose-latest"}
androidx-compose-material = { module = "androidx.compose.material:material" }
androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-material3-adaptive = { module = "androidx.compose.material3.adaptive:adaptive", version.ref = "androidx-compose-material3-adaptive" }
Expand Down Expand Up @@ -138,7 +136,6 @@ androidx-window-core = { module = "androidx.window:window-core", version.ref = "
coil-kt-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
core-jdk-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "jdkDesugar" }
dagger-hiltandroidplugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
google-android-material = { module = "com.google.android.material:material", version.ref = "material" }
googlemaps-compose = { module = "com.google.maps.android:maps-compose", version.ref = "maps-compose" }
googlemaps-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "google-maps" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/mobile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ android {
excludes += "/META-INF/LGPL2.1"
}
}

kotlin {
jvmToolchain(17)
}
composeCompiler {
enableStrongSkippingMode = true
}
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/tv/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ android {
}
}
}

kotlin {
jvmToolchain(17)
}
composeCompiler {
enableStrongSkippingMode = true
}
Expand Down
4 changes: 3 additions & 1 deletion Jetcaster/wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ android {
}
}
}

kotlin {
jvmToolchain(17)
}
dependencies {


Expand Down
5 changes: 3 additions & 2 deletions Jetchat/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ android {
composeCompiler {
enableStrongSkippingMode = true
}

kotlin {
jvmToolchain(17)
}
dependencies {
val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
Expand All @@ -100,7 +102,6 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation.ui.ktx)
implementation(libs.google.android.material)

implementation(libs.androidx.compose.foundation.layout)
implementation(libs.androidx.compose.material3)
Expand Down
2 changes: 1 addition & 1 deletion Jetchat/app/src/main/res/values-v23/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<resources>

<style name="Platform.Theme.Jetchat" parent="Theme.Material3.DayNight">
<style name="Platform.Theme.Jetchat" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
Expand Down
2 changes: 1 addition & 1 deletion Jetchat/app/src/main/res/values-v27/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<resources>

<style name="Platform.Theme.Jetchat" parent="Theme.Material3.DayNight">
<style name="Platform.Theme.Jetchat" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
Expand Down
2 changes: 1 addition & 1 deletion Jetchat/app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<!-- Allows us to override platform level specific attributes in their
respective values-vXX folder. -->
<style name="Platform.Theme.Jetchat" parent="Theme.Material3.DayNight">
<style name="Platform.Theme.Jetchat" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@color/black30</item>
</style>

Expand Down
3 changes: 0 additions & 3 deletions Jetchat/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ kotlin = "2.0.0"
kotlinx_immutable = "0.3.7"
ksp = "2.0.0-1.0.21"
maps-compose = "3.1.1"
material = "1.11.0"
# @keep
minSdk = "21"
okhttp = "4.11.0"
Expand Down Expand Up @@ -78,7 +77,6 @@ androidx-compose-animation = { module = "androidx.compose.animation:animation",
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-latest"}
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" ,version.ref = "androidx-compose-latest"}
androidx-compose-material = { module = "androidx.compose.material:material" }
androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-material3-adaptive = { module = "androidx.compose.material3.adaptive:adaptive", version.ref = "androidx-compose-material3-adaptive" }
Expand Down Expand Up @@ -138,7 +136,6 @@ androidx-window-core = { module = "androidx.window:window-core", version.ref = "
coil-kt-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
core-jdk-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "jdkDesugar" }
dagger-hiltandroidplugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
google-android-material = { module = "com.google.android.material:material", version.ref = "material" }
googlemaps-compose = { module = "com.google.maps.android:maps-compose", version.ref = "maps-compose" }
googlemaps-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "google-maps" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
Expand Down
14 changes: 9 additions & 5 deletions Jetsnack/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ android {
getByName("release") {
isMinifyEnabled = true
signingConfig = signingConfigs.getByName("release")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}

create("benchmark") {
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("release")
matchingFallbacks.add("release")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-benchmark-rules.pro")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-benchmark-rules.pro"
)
isDebuggable = false
}
}
Expand Down Expand Up @@ -114,7 +118,7 @@ dependencies {
implementation(libs.androidx.compose.foundation.layout)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.util)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.animation)
implementation(libs.androidx.compose.material.iconsExtended)
implementation(libs.androidx.compose.ui.tooling.preview)
Expand Down
9 changes: 5 additions & 4 deletions Jetsnack/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2020 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -27,12 +26,14 @@

>

<profileable android:shell="true" tools:targetApi="q" />
<profileable
android:shell="true"
tools:targetApi="q" />

<activity
android:name=".ui.MainActivity"
android:theme="@style/Theme.Jetsnack"
android:exported="true"
android:theme="@style/Theme.Jetsnack"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Filter(
) {
val enabled = mutableStateOf(enabled)
}

val filters = listOf(
Filter(name = "Organic"),
Filter(name = "Gluten-free"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.material.SnackbarHost
import androidx.compose.material3.SnackbarHost
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
Expand Down Expand Up @@ -71,11 +72,12 @@ fun JetsnackApp() {
) {
composableWithCompositionLocal(
route = MainDestinations.HOME_ROUTE
) {
) { backStackEntry ->
MainContainer(
onSnackSelected = jetsnackNavController::navigateToSnackDetail
)
}

composableWithCompositionLocal(
"${MainDestinations.SNACK_DETAIL_ROUTE}/" +
"{${MainDestinations.SNACK_ID_KEY}}" +
Expand Down Expand Up @@ -151,15 +153,17 @@ fun MainContainer(
snackbar = { snackbarData -> JetsnackSnackbar(snackbarData) }
)
},
scaffoldState = jetsnackScaffoldState.scaffoldState,
) { paddingValues ->
snackBarHostState = jetsnackScaffoldState.snackBarHostState,
) { padding ->
NavHost(
navController = nestedNavController.navController,
startDestination = HomeSections.FEED.route
) {
addHomeGraph(
onSnackSelected = onSnackSelected,
modifier = Modifier.padding(paddingValues)
modifier = Modifier
.padding(padding)
.consumeWindowInsets(padding)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ enum class SnackSharedElementType {
Tagline,
Background
}

object FilterSharedElementKey
Loading
Loading