Skip to content
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
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ plugins {
alias(libs.plugins.google.services)
alias(libs.plugins.crashlytics)
alias(libs.plugins.baselineprofile)
id("com.google.android.gms.oss-licenses-plugin")
}

android {
Expand Down Expand Up @@ -111,6 +112,10 @@ dependencies {
implementation(libs.firebase.appcheck.debug)

implementation(libs.androidx.window)
implementation(libs.androidx.appcompat)
implementation(libs.google.oss.licenses) {
exclude(group = "androidx.appcompat")
}

implementation(projects.feature.camera)
implementation(projects.feature.creation)
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- need to use Theme.AppCompat -->
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/AppCompatAndroidify" />

<!-- needs to use Theme.AppCompat -->
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/AppCompatAndroidify" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package com.android.developers.androidify.navigation

import android.content.Intent
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.fadeIn
Expand All @@ -29,6 +30,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.IntOffset
import androidx.lifecycle.viewmodel.navigation3.rememberViewModelStoreNavEntryDecorator
import androidx.navigation3.runtime.entry
Expand All @@ -40,6 +42,8 @@ import com.android.developers.androidify.creation.CreationScreen
import com.android.developers.androidify.home.AboutScreen
import com.android.developers.androidify.home.HomeScreen
import com.android.developers.androidify.theme.transitions.ColorSplashTransitionScreen
import com.google.android.gms.oss.licenses.OssLicensesActivity
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity

@ExperimentalMaterial3ExpressiveApi
@Composable
Expand Down Expand Up @@ -110,10 +114,14 @@ fun MainNavigation() {
)
}
entry<About> {
val context = LocalContext.current
AboutScreen(
onBackPressed = {
backStack.removeLastOrNull()
},
onLicensesClicked = {
context.startActivity(Intent(context, OssLicensesMenuActivity::class.java))
}
)
}
},
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/res/values-v35/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>

<style name="AppCompatAndroidify" parent="Theme.AppCompat.DayNight">
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/white</item>
<item name="android:fitsSystemWindows">true</item>
<!-- https://github.com/google/play-services-plugins/issues/296 -->
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@
<resources>

<style name="Theme.Androidify" parent="android:Theme.Material.Light.NoActionBar" />

<style name="AppCompatAndroidify" parent="Theme.AppCompat.DayNight">
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/white</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
10 changes: 9 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ plugins {
alias(libs.plugins.baselineprofile) apply false
alias(libs.plugins.spotless) apply false
}

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath(libs.google.oss.licenses.plugin)
}
}

subprojects {
apply(plugin = "com.diffplug.spotless")
Expand Down
3 changes: 3 additions & 0 deletions feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ dependencies {
implementation(libs.androidx.hilt.navigation.compose)
implementation(libs.androidx.media3.exoplayer)
implementation(libs.androidx.media3.ui.compose)
implementation(libs.google.oss.licenses) {
exclude(group = "androidx.appcompat")
}
ksp(libs.hilt.compiler)

implementation(libs.ai.edge) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -69,22 +70,23 @@ import com.android.developers.androidify.util.isAtLeastMedium
@Composable
private fun AboutPreviewCompact() {
SharedElementContextPreview {
AboutScreen(isMediumWindowSize = false) {}
AboutScreen(isMediumWindowSize = false, {}, {})
}
}

@LargeScreensPreview
@Composable
private fun AboutPreviewLargeScreens() {
SharedElementContextPreview {
AboutScreen(isMediumWindowSize = true) {}
AboutScreen(isMediumWindowSize = true, {}, {})
}
}

@Composable
fun AboutScreen(
isMediumWindowSize: Boolean = isAtLeastMedium(),
onBackPressed: () -> Unit,
onLicensesClicked: () -> Unit
) {
val sharedElementScope = LocalSharedTransitionScope.current
val navScope = LocalNavAnimatedContentScope.current
Expand Down Expand Up @@ -163,7 +165,8 @@ fun AboutScreen(
)
}
Spacer(Modifier.size(48.dp))
FooterButtons(modifier = Modifier.padding(bottom = 8.dp))
FooterButtons(modifier = Modifier.padding(bottom = 8.dp),
onLicensesClicked)
}
}
} else {
Expand Down Expand Up @@ -197,30 +200,36 @@ fun AboutScreen(
stringResource(R.string.about_step3_label),
)
Spacer(modifier = Modifier.size(24.dp))
FooterButtons(modifier = Modifier.padding(bottom = 8.dp))
FooterButtons(modifier = Modifier.padding(bottom = 8.dp), onLicensesClicked)
}
}
}
}
}

@Composable
private fun FooterButtons(modifier: Modifier = Modifier) {
private fun FooterButtons(modifier: Modifier = Modifier,
onLicensesClicked: () -> Unit) {
val uriHandler = LocalUriHandler.current
Row(modifier) {
FlowRow(modifier, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
SecondaryOutlinedButton(
onClick = {
uriHandler.openUri("https://policies.google.com/terms")
},
buttonText = stringResource(R.string.terms),
)
Spacer(modifier = Modifier.size(16.dp))
SecondaryOutlinedButton(
onClick = {
uriHandler.openUri("https://policies.google.com/privacy")
},
buttonText = stringResource(R.string.privacy),
)
SecondaryOutlinedButton(
onClick = {
onLicensesClicked()
},
buttonText = stringResource(R.string.oss_license),
)
}
}

Expand Down
1 change: 1 addition & 0 deletions feature/home/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@
<string name="pause">Pause</string>
<string name="terms">Terms</string>
<string name="privacy">Privacy</string>
<string name="oss_license">Licenses</string>
</resources>
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ espressoCore = "3.6.1"
firebaseBom = "33.14.0"
firebaseConfigKtx = "22.1.1"
googleServices = "4.4.2"
googleOss = "17.1.0"
googleOssPlugin = "0.10.6"
hiltAndroid = "2.56.2"
hiltLifecycleViewmodel = "1.0.0-alpha03"
hiltNavigationCompose = "1.2.0"
Expand Down Expand Up @@ -130,7 +132,8 @@ androidx-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomato
androidx-benchmark-macro-junit4 = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "benchmarkMacroJunit4" }
androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "profileinstaller" }
ai-edge = { group = "com.google.ai.edge.aicore", name = "aicore", version.ref = "aiEdge" }

google-oss-licenses = { group = "com.google.android.gms", name = "play-services-oss-licenses", version.ref = "googleOss" }
google-oss-licenses-plugin = { group = "com.google.android.gms", name = "oss-licenses-plugin", version.ref = "googleOssPlugin" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
Expand Down