diff --git a/.github/workflows/apply_spotless.yml b/.github/workflows/apply_spotless.yml index d69f817b0..3727da63a 100644 --- a/.github/workflows/apply_spotless.yml +++ b/.github/workflows/apply_spotless.yml @@ -42,7 +42,7 @@ jobs: java-version: '17' - name: Run spotlessApply - run: ./gradlew spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace + run: ./gradlew spotlessApply --stacktrace - name: Auto-commit if spotlessApply has changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72e815a31..1d3c201ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,11 +32,11 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.PAT || github.token }} - - name: set up Java 17 + - name: set up Java 25 uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '17' + java-version: '25' - name: Build All run: ./gradlew build --stacktrace - name: Build Watch Face Push validation snippets diff --git a/.gitignore b/.gitignore index b984a9c26..7b190dc83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,11 @@ *.iml .gradle /local.properties -/.idea/caches/build_file_checksums.ser -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml +.idea/ .DS_Store build /captures .externalNativeBuild -.idea/* -/.idea/* .kotlin ### Xcode ### diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index ae78c113f..000000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
-
-
\ No newline at end of file diff --git a/bluetoothle/src/main/AndroidManifest.xml b/bluetoothle/src/main/AndroidManifest.xml index d15b213e2..b42865576 100644 --- a/bluetoothle/src/main/AndroidManifest.xml +++ b/bluetoothle/src/main/AndroidManifest.xml @@ -1,4 +1,19 @@ + @@ -24,4 +39,4 @@ - \ No newline at end of file + diff --git a/bluetoothle/src/main/res/layout/activity_main.xml b/bluetoothle/src/main/res/layout/activity_main.xml index b692bf4a3..b46563beb 100644 --- a/bluetoothle/src/main/res/layout/activity_main.xml +++ b/bluetoothle/src/main/res/layout/activity_main.xml @@ -1,4 +1,19 @@ + - \ No newline at end of file + diff --git a/bluetoothle/src/main/res/values/strings.xml b/bluetoothle/src/main/res/values/strings.xml index 7abc06d3b..fa7796f20 100644 --- a/bluetoothle/src/main/res/values/strings.xml +++ b/bluetoothle/src/main/res/values/strings.xml @@ -1 +1,17 @@ + + diff --git a/build.gradle.kts b/build.gradle.kts index 899385a15..d4ea18313 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,6 +13,93 @@ plugins { alias(libs.plugins.kotlin.multiplatform) apply false alias(libs.plugins.android.kotlin.multiplatform.library) apply false alias(libs.plugins.android.lint) apply false + alias(libs.plugins.spotless) apply false +} + +allprojects { + apply(plugin = "com.diffplug.spotless") + extensions.configure { + kotlin { + target("**/*.kt") + targetExclude("**/build/**/*.kt", "spotless/**/*.kt") + + val disabledRules = arrayOf( + // These rules were introduced in ktlint 0.46.0 and should not be + // enabled without further discussion. They are disabled for now. + // See: https://github.com/pinterest/ktlint/releases/tag/0.46.0 + "filename", + "annotation", + "annotation-spacing", + "argument-list-wrapping", + "double-colon-spacing", + "enum-entry-name-case", + "multiline-if-else", + "no-empty-first-line-in-method-block", + "package-name", + "trailing-comma", + "spacing-around-angle-brackets", + "spacing-between-declarations-with-annotations", + "spacing-between-declarations-with-comments", + "unary-op-spacing", + "no-trailing-spaces", + "max-line-length", + // Disabled rules that were introduced or changed between 0.46.0 ~ 1.50.0 + "class-signature", + "trailing-comma-on-call-site", + "trailing-comma-on-declaration-site", + "comment-wrapping", + "function-literal", + "function-signature", + "function-expression-body", + "function-start-of-body-spacing", + "multiline-expression-wrapping", + ) + + ktlint(libs.versions.ktlint.get()).editorConfigOverride( + mapOf( + "android" to "true", + "ktlint_code_style" to "android_studio", + "ij_kotlin_allow_trailing_comma" to "true", + ) + disabledRules.map { Pair("ktlint_standard_$it", "disabled") } + ) + + // ktlint 7.0.0 introduces lints, which existing snippets do not satisfy + val kotlinSuppressLints = arrayOf( + "standard:function-naming", + "standard:property-naming", + "standard:class-naming", + "standard:max-line-length", + "standard:comment-wrapping", + "standard:import-ordering", + "standard:filename", + "standard:backing-property-naming", + ) + for (lint in kotlinSuppressLints) { + suppressLintsFor { + step = "ktlint" + shortCode = lint + } + } + + licenseHeaderFile(rootProject.file("spotless/copyright.kt")) + } + kotlinGradle { + target("**/*.kts") + targetExclude("**/build/**/*.kts", "spotless/**/*.kts") + // Look for the first line that doesn't have a block comment (assumed to be the license) + licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)") + } + format("xml") { + target("**/*.xml") + targetExclude( + "**/build/**/*.xml", + "spotless/**/*.xml", + ".idea/**", + ) + // Look for the root tag or a tag that is a snippet + licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[a-zA-Z])|( + Copyright 2018 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. +--> RecomposeHighlighter diff --git a/compose/recomposehighlighter/src/main/res/values/themes.xml b/compose/recomposehighlighter/src/main/res/values/themes.xml index 918929c1b..f94279433 100644 --- a/compose/recomposehighlighter/src/main/res/values/themes.xml +++ b/compose/recomposehighlighter/src/main/res/values/themes.xml @@ -1,5 +1,21 @@ + + - \ No newline at end of file + diff --git a/compose/snippets/build.gradle.kts b/compose/snippets/build.gradle.kts index c8d728da0..7a5062f65 100644 --- a/compose/snippets/build.gradle.kts +++ b/compose/snippets/build.gradle.kts @@ -25,7 +25,9 @@ plugins { } android { - compileSdk = libs.versions.compileSdk.get().toInt() + compileSdk { + version = release(libs.versions.compileSdk.get().toInt()) + {minorApiLevel = 1}} // Android 16 QPR 2 namespace = "com.example.compose.snippets" defaultConfig { @@ -163,4 +165,6 @@ dependencies { androidTestImplementation(libs.androidx.compose.ui.test.junit4.accessibility) debugImplementation(libs.androidx.compose.ui.test.manifest) + androidTestImplementation(libs.androidx.glance.testing) + androidTestImplementation(libs.androidx.glance.appwidget.testing) } diff --git a/compose/snippets/lint.xml b/compose/snippets/lint.xml index 778dd98f3..9ec5c3429 100644 --- a/compose/snippets/lint.xml +++ b/compose/snippets/lint.xml @@ -1,6 +1,21 @@ - + + - \ No newline at end of file + diff --git a/compose/snippets/src/androidTest/java/com/example/compose/snippets/glance/GlanceUnitTest.kt b/compose/snippets/src/androidTest/java/com/example/compose/snippets/glance/GlanceUnitTest.kt new file mode 100644 index 000000000..05698d1a3 --- /dev/null +++ b/compose/snippets/src/androidTest/java/com/example/compose/snippets/glance/GlanceUnitTest.kt @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.example.compose.snippets.glance + +import androidx.compose.runtime.Composable +import androidx.glance.GlanceModifier +import androidx.glance.appwidget.testing.unit.runGlanceAppWidgetUnitTest +import androidx.glance.layout.Row +import androidx.glance.semantics.semantics +import androidx.glance.semantics.testTag +import androidx.glance.testing.unit.assertHasText +import androidx.glance.testing.unit.hasTestTag +import androidx.glance.text.Text +import org.junit.Test + +// [START android_compose_glance_unit_test] +private const val FAKE_HEADLINE = "EXTRA! EXTRA! READ ALL ABOUT IT!" + +class MyGlanceComposableTest { + @Test + fun myNewsItemComposable_largeSize_hasHeadline() = runGlanceAppWidgetUnitTest { + // Set the composable to test + provideComposable { + MyNewsItemComposable(FAKE_HEADLINE) + } + + // Perform assertions + onNode(hasTestTag("headline")) + .assertHasText(FAKE_HEADLINE) + } + + + @Composable + fun MyNewsItemComposable(headline: String) { + Row { + Text( + text = headline, + modifier = GlanceModifier.semantics { testTag = "headline" }, + ) + } + } +} +// [END android_compose_glance_unit_test] \ No newline at end of file diff --git a/compose/snippets/src/main/AndroidManifest.xml b/compose/snippets/src/main/AndroidManifest.xml index 4ec4d9b70..5c0f57b2e 100644 --- a/compose/snippets/src/main/AndroidManifest.xml +++ b/compose/snippets/src/main/AndroidManifest.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> @@ -70,4 +69,4 @@ - \ No newline at end of file + diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt b/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt index e8d06f783..6221902cf 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt @@ -17,6 +17,7 @@ package com.example.compose.snippets.adaptivelayouts import androidx.annotation.StringRes +import androidx.compose.foundation.layout.Arrangement import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.AccountBox import androidx.compose.material.icons.filled.Favorite @@ -28,6 +29,7 @@ import androidx.compose.material3.NavigationBarItemDefaults import androidx.compose.material3.Text import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteDefaults +import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteItem import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffoldDefaults import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType @@ -154,6 +156,34 @@ fun SampleNavigationSuiteScaffoldColors() { // [END android_compose_adaptivelayouts_sample_navigation_suite_scaffold_item_colors] } +@Composable +fun SampleNavigationSuiteScaffoldIconsAlignment() { + var currentDestination by rememberSaveable { mutableStateOf(AppDestinations.HOME) } + + // [START android_compose_adaptivelayouts_sample_navigation_suite_scaffold_icons_alignment] + NavigationSuiteScaffold( + navigationItems = { + AppDestinations.entries.forEach { + NavigationSuiteItem( + icon = { + Icon( + it.icon, + contentDescription = stringResource(it.contentDescription) + ) + }, + label = { Text(stringResource(it.label)) }, + selected = it == currentDestination, + onClick = { currentDestination = it }, + ) + } + }, + navigationItemVerticalArrangement = Arrangement.Center + ) { + // TODO: Destination content. + } + // [END android_compose_adaptivelayouts_sample_navigation_suite_scaffold_icons_alignment] +} + @Composable fun SampleNavigationSuiteScaffoldCustomType() { // [START android_compose_adaptivelayouts_sample_navigation_suite_scaffold_layout_type] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/AppBar.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/AppBar.kt index 354efe635..72b4586a0 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/AppBar.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/AppBar.kt @@ -218,7 +218,7 @@ fun CenterAlignedTopAppBarExample() { topBar = { CenterAlignedTopAppBar( - colors = TopAppBarDefaults.centerAlignedTopAppBarColors( + colors = TopAppBarDefaults.topAppBarColors( containerColor = MaterialTheme.colorScheme.primaryContainer, titleContentColor = MaterialTheme.colorScheme.primary, ), @@ -431,6 +431,7 @@ fun AppBarSelectionActions( } } }, + modifier = modifier ) } // [END android_compose_components_appbarselectionactions] @@ -454,6 +455,7 @@ private fun AppBarMultiSelectionExample( var selectedItems by rememberSaveable { mutableStateOf(setOf()) } Scaffold( + modifier = modifier, topBar = { AppBarSelectionActions(selectedItems) } ) { innerPadding -> LazyColumn(contentPadding = innerPadding) { @@ -517,7 +519,8 @@ fun LazyListMultiSelection( ) { var selectedItems by rememberSaveable { mutableStateOf(setOf()) } - LazyColumn(contentPadding = contentPadding) { + LazyColumn(modifier = modifier, + contentPadding = contentPadding) { itemsIndexed(listItems) { _, index -> val selected = selectedItems.contains(index) ListItemSelectable( diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/DatePickers.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/DatePickers.kt index 692199123..4d59ea4ef 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/DatePickers.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/DatePickers.kt @@ -57,7 +57,7 @@ import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Popup -import com.example.compose.snippets.touchinput.userinteractions.MyAppTheme +import com.example.compose.snippets.ui.theme.SnippetsTheme import java.text.SimpleDateFormat import java.util.Date import java.util.Locale @@ -65,7 +65,7 @@ import java.util.Locale @Preview @Composable private fun DatePickerPreview() { - MyAppTheme { + SnippetsTheme { DatePickerExamples() } } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/PullToRefreshBox.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/PullToRefreshBox.kt index 81280151a..5dbcb9221 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/PullToRefreshBox.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/PullToRefreshBox.kt @@ -32,11 +32,10 @@ import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.pulltorefresh.PullToRefreshBox -import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.Indicator import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.PositionalThreshold import androidx.compose.material3.pulltorefresh.PullToRefreshState -import androidx.compose.material3.pulltorefresh.pullToRefreshIndicator +import androidx.compose.material3.pulltorefresh.pullToRefresh import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -187,11 +186,13 @@ fun MyCustomIndicator( modifier: Modifier = Modifier, ) { Box( - modifier = modifier.pullToRefreshIndicator( + modifier = modifier.pullToRefresh( state = state, isRefreshing = isRefreshing, - containerColor = PullToRefreshDefaults.containerColor, - threshold = PositionalThreshold + threshold = PositionalThreshold, + onRefresh = { + + } ), contentAlignment = Alignment.Center ) { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/Tooltips.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/Tooltips.kt index 1066d0cfb..9a034e261 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/Tooltips.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/Tooltips.kt @@ -166,7 +166,6 @@ fun AdvancedRichTooltipExample( } } }, - caretSize = DpSize(32.dp, 16.dp) ) { Text(richTooltipText) } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Mdc3ThemeSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Mdc3ThemeSnippets.kt deleted file mode 100644 index 5e3e4000f..000000000 --- a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Mdc3ThemeSnippets.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2022 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. - */ - -package com.example.compose.snippets.designsystems - -import android.os.Bundle -import androidx.activity.compose.setContent -import androidx.appcompat.app.AppCompatActivity -// [START android_compose_designsystems_interop_mdc3theme] -import com.google.accompanist.themeadapter.material3.Mdc3Theme - -class Mdc3ThemeExample : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - // Use Mdc3Theme instead of M3 MaterialTheme - // Color scheme, typography, and shapes have been read from the - // View-based theme used in this Activity - setContent { - Mdc3Theme { - // Your app-level composable here - } - } - } -} -// [END android_compose_designsystems_interop_mdc3theme] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceMetrics.kt b/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceMetrics.kt new file mode 100644 index 000000000..3541cceb4 --- /dev/null +++ b/compose/snippets/src/main/java/com/example/compose/snippets/glance/GlanceMetrics.kt @@ -0,0 +1,95 @@ +/* + * 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. + */ + +package com.example.compose.snippets.glance + +import android.appwidget.AppWidgetManager +import android.content.Context +import android.os.Build +import android.util.Log +import androidx.annotation.RequiresApi + +private const val TAG = "WidgetMetrics" + +class GlanceMetrics { + + // [START android_compose_glance_metrics] + @RequiresApi(Build.VERSION_CODES_FULL.BAKLAVA_1) + fun getWidgetEngagementMetrics(context: Context) { + val manager = AppWidgetManager.getInstance(context) + + val endTime = System.currentTimeMillis() + val startTime = endTime - (24 * 60 * 60 * 1000) // a day ago + + val events = manager.queryAppWidgetEvents(startTime, endTime) + + if (events.isEmpty()) { + Log.d(TAG, "No events found for the given time range.") + } + + val metrics = hashMapOf( + "clicks" to 0L, + "scrolls" to 0L, + "totalImpressionLength" to 0L + ) + + for (event in events) { + + Log.d(TAG, "Event Start: ${event.start}") + Log.d(TAG, "Event End: ${event.end}") + + val widgetId = event.appWidgetId + + // Tap actions + val clickedIds = event.clickedIds + if (clickedIds?.isNotEmpty() == true) { + metrics["clicks"] = metrics.getValue("clicks") + clickedIds.size + // Log or analyze which components were clicked. + for (id in clickedIds) { + Log.d(TAG, "Widget $widgetId: Tap event on component with ID $id") + } + } + + // Scroll events + val scrolledIds = event.scrolledIds + if (scrolledIds?.isNotEmpty() == true) { + metrics["scrolls"] = metrics.getValue("scrolls") + scrolledIds.size + // Log or analyze which lists were scrolled. + for (id in scrolledIds) { + Log.d(TAG, "Widget $widgetId: Scroll event in list with ID/tag $id") + } + } + + // Impressions + metrics["totalImpressionLength"] = metrics.getValue("totalImpressionLength") + event.visibleDuration.toMillis() + Log.d( + TAG, + "Widget $widgetId: Impression event with duration " + event.visibleDuration.toMillis() + "ms" + ) + + // Position + val position = event.position + if (position != null) { + Log.d( + TAG, + "Widget $widgetId: left=${position.left}, right=${position.right}, top=${position.top}, bottom=${position.bottom}" + ) + } + } + Log.d("WidgetMetrics", "Metrics: $metrics") + } + // [END android_compose_glance_metrics] +} diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt index 59ac0129d..fec60d697 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt @@ -58,7 +58,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.unit.dp import androidx.fragment.app.Fragment -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.ViewModel import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/FlowLayoutSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/FlowLayoutSnippets.kt index 60e795874..8c682a601 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/FlowLayoutSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/FlowLayoutSnippets.kt @@ -21,9 +21,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.ContextualFlowRow -import androidx.compose.foundation.layout.ContextualFlowRowOverflow -import androidx.compose.foundation.layout.ContextualFlowRowOverflowScope import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowColumn import androidx.compose.foundation.layout.FlowRow @@ -33,22 +30,13 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width -import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.foundation.verticalScroll import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material3.FilterChip import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color @@ -465,48 +453,6 @@ fun FlowLayout_FractionalSizing() { // [END android_compose_flow_layout_fractional_sizing] } -@OptIn(ExperimentalLayoutApi::class) -@Preview -@Composable -fun ContextualFlowLayoutExample() { - // [START android_compose_layouts_contextual_flow] - val totalCount = 40 - var maxLines by remember { - mutableIntStateOf(2) - } - - val moreOrCollapseIndicator = @Composable { scope: ContextualFlowRowOverflowScope -> - val remainingItems = totalCount - scope.shownItemCount - ChipItem(if (remainingItems == 0) "Less" else "+$remainingItems", onClick = { - if (remainingItems == 0) { - maxLines = 2 - } else { - maxLines += 5 - } - }) - } - ContextualFlowRow( - modifier = Modifier - .safeDrawingPadding() - .fillMaxWidth(1f) - .padding(16.dp) - .wrapContentHeight(align = Alignment.Top) - .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.spacedBy(4.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp), - maxLines = maxLines, - overflow = ContextualFlowRowOverflow.expandOrCollapseIndicator( - minRowsToShowCollapse = 4, - expandIndicator = moreOrCollapseIndicator, - collapseIndicator = moreOrCollapseIndicator - ), - itemCount = totalCount - ) { index -> - ChipItem("Item $index") - } - // [END android_compose_layouts_contextual_flow] -} - @OptIn(ExperimentalLayoutApi::class) @Preview @Composable diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt index 031d78dfb..e893e8099 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt @@ -31,6 +31,8 @@ import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.fitInside import androidx.compose.foundation.layout.ime import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.navigationBars @@ -49,9 +51,12 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TextField import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment.Companion.BottomCenter import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.RectRulers import androidx.compose.ui.layout.WindowInsetsRulers +import androidx.compose.ui.layout.innermostOf import androidx.compose.ui.layout.layout import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Constraints @@ -208,3 +213,53 @@ fun Modifier.alignToSafeDrawing(): Modifier { } } // [END android_compose_insets_rulers] + +// [START android_compose_insets_fit_inside] +@Composable +fun FitInsideDemo(modifier: Modifier) { + Box( + modifier = modifier + .fillMaxSize() + // Or DisplayCutout, Ime, NavigationBars, StatusBar, etc... + .fitInside(WindowInsetsRulers.SafeDrawing.current) + ) +} +// [END android_compose_insets_fit_inside] + +// [START android_compose_insets_rulers_ime] +@Composable +fun FitInsideWithImeDemo(modifier: Modifier) { + Box( + modifier = modifier + .fillMaxSize() + .fitInside( + RectRulers.innermostOf( + WindowInsetsRulers.NavigationBars.current, + WindowInsetsRulers.Ime.current + ) + ) + ) { + TextField( + value = "Demo IME Insets", + onValueChange = {}, + modifier = modifier.align(Alignment.BottomStart).fillMaxWidth() + ) + } +} +// [END android_compose_insets_rulers_ime] + +// [START android_compose_insets_rulers_status_caption_bars] +@Composable +fun FitInsideWithStatusAndCaptionBarDemo(modifier: Modifier) { + Box( + modifier = modifier + .fillMaxSize() + .fitInside( + RectRulers.innermostOf( + WindowInsetsRulers.StatusBars.current, + WindowInsetsRulers.CaptionBar.current + ) + ) + ) +} +// [END android_compose_insets_rulers_status_caption_bars] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt index 899163367..e09fe456d 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt @@ -50,8 +50,8 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Button import androidx.compose.material3.Card import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.PrimaryTabRow import androidx.compose.material3.Tab -import androidx.compose.material3.TabRow import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -239,7 +239,7 @@ fun PagerWithTabsExample() { pages.size }) - TabRow( + PrimaryTabRow( // Our selected tab is our current page selectedTabIndex = pagerState.currentPage, ) { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt index 0a2f34a56..f964e352d 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt @@ -26,6 +26,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Menu import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -109,7 +110,7 @@ fun Colors() { // #FFBB86FC // In your Compose code - Divider(color = colorResource(R.color.purple_200)) + HorizontalDivider(color = colorResource(R.color.purple_200)) // [END android_compose_resources_colors] } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/state/StateHoistingSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/state/StateHoistingSnippets.kt index 2a4f0c949..2e607fde9 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/state/StateHoistingSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/state/StateHoistingSnippets.kt @@ -18,6 +18,8 @@ package com.example.compose.snippets.state +import android.R.id.message +import androidx.compose.foundation.clickable import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items @@ -34,7 +36,13 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow +import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.LinkAnnotation +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.TextLinkStyles +import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.withLink import androidx.lifecycle.ViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewModelScope @@ -60,9 +68,11 @@ private object StateHoistingSnippets1 { ) { var showDetails by rememberSaveable { mutableStateOf(false) } // Define the UI element expanded state - ClickableText( + Text( text = AnnotatedString(message.content), - onClick = { showDetails = !showDetails } // Apply simple UI logic + modifier = Modifier.clickable { + showDetails = !showDetails // Apply UI logic + } ) if (showDetails) { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/userinteractions/UserInteractions.kt b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/userinteractions/UserInteractions.kt index 12de9f923..6b9fa3fda 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/userinteractions/UserInteractions.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/userinteractions/UserInteractions.kt @@ -37,7 +37,6 @@ import androidx.compose.material.ripple.RippleAlpha import androidx.compose.material.ripple.RippleTheme import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.LocalUseFallbackRippleImplementation import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider @@ -240,28 +239,6 @@ private class ScaleIndicationNode( fun App() { } -@OptIn(ExperimentalMaterial3Api::class) -@Composable -private fun LocalUseFallbackRippleImplementationExample() { -// [START android_compose_userinteractions_localusefallbackrippleimplementation] - CompositionLocalProvider(LocalUseFallbackRippleImplementation provides true) { - MaterialTheme { - App() - } - } -// [END android_compose_userinteractions_localusefallbackrippleimplementation] -} - -// [START android_compose_userinteractions_localusefallbackrippleimplementation_app_theme] -@OptIn(ExperimentalMaterial3Api::class) -@Composable -fun MyAppTheme(content: @Composable () -> Unit) { - CompositionLocalProvider(LocalUseFallbackRippleImplementation provides true) { - MaterialTheme(content = content) - } -} -// [END android_compose_userinteractions_localusefallbackrippleimplementation_app_theme] - @OptIn(ExperimentalMaterialApi::class) @Composable private fun MyComposableDisabledRippleConfig() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/ui/theme/Type.kt b/compose/snippets/src/main/java/com/example/compose/snippets/ui/theme/Type.kt index acf007bfd..ab604e852 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/ui/theme/Type.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/ui/theme/Type.kt @@ -46,5 +46,5 @@ val Typography = Typography( lineHeight = 16.sp, letterSpacing = 0.5.sp ) - */ + */ ) diff --git a/compose/snippets/src/main/res/drawable-v24/ic_launcher_foreground.xml b/compose/snippets/src/main/res/drawable-v24/ic_launcher_foreground.xml index 2f9758487..0f6026a41 100644 --- a/compose/snippets/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/compose/snippets/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,19 +1,19 @@ + + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/drawable/baseline_directions_bus_24.xml b/compose/snippets/src/main/res/drawable/baseline_directions_bus_24.xml index 2de5d0a86..745eab18a 100644 --- a/compose/snippets/src/main/res/drawable/baseline_directions_bus_24.xml +++ b/compose/snippets/src/main/res/drawable/baseline_directions_bus_24.xml @@ -1,19 +1,19 @@ + + Copyright 2023 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. +--> diff --git a/compose/snippets/src/main/res/drawable/baseline_shopping_cart_24.xml b/compose/snippets/src/main/res/drawable/baseline_shopping_cart_24.xml index 817fb0539..15368afa6 100644 --- a/compose/snippets/src/main/res/drawable/baseline_shopping_cart_24.xml +++ b/compose/snippets/src/main/res/drawable/baseline_shopping_cart_24.xml @@ -1,19 +1,19 @@ + + Copyright 2023 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. +--> diff --git a/compose/snippets/src/main/res/drawable/button_outline.xml b/compose/snippets/src/main/res/drawable/button_outline.xml index f4eb02291..790fd2eb2 100644 --- a/compose/snippets/src/main/res/drawable/button_outline.xml +++ b/compose/snippets/src/main/res/drawable/button_outline.xml @@ -1,22 +1,22 @@ + + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/drawable/fast_forward.xml b/compose/snippets/src/main/res/drawable/fast_forward.xml index d49dffbf3..95cdea9c4 100644 --- a/compose/snippets/src/main/res/drawable/fast_forward.xml +++ b/compose/snippets/src/main/res/drawable/fast_forward.xml @@ -1,3 +1,19 @@ + + + + + + + diff --git a/compose/snippets/src/main/res/drawable/ic_launcher_background.xml b/compose/snippets/src/main/res/drawable/ic_launcher_background.xml index 4c2360d21..2edadf928 100644 --- a/compose/snippets/src/main/res/drawable/ic_launcher_background.xml +++ b/compose/snippets/src/main/res/drawable/ic_launcher_background.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> + Copyright 2023 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. +--> diff --git a/compose/snippets/src/main/res/drawable/ic_moon_24.xml b/compose/snippets/src/main/res/drawable/ic_moon_24.xml index 527559f3f..b1c551d5e 100644 --- a/compose/snippets/src/main/res/drawable/ic_moon_24.xml +++ b/compose/snippets/src/main/res/drawable/ic_moon_24.xml @@ -1,3 +1,19 @@ + + diff --git a/compose/snippets/src/main/res/drawable/ic_sun_24.xml b/compose/snippets/src/main/res/drawable/ic_sun_24.xml index a63c6400e..4bac89d3e 100644 --- a/compose/snippets/src/main/res/drawable/ic_sun_24.xml +++ b/compose/snippets/src/main/res/drawable/ic_sun_24.xml @@ -1,3 +1,19 @@ + + diff --git a/compose/snippets/src/main/res/layout/activity_example.xml b/compose/snippets/src/main/res/layout/activity_example.xml index be37892ac..b85c61cf1 100644 --- a/compose/snippets/src/main/res/layout/activity_example.xml +++ b/compose/snippets/src/main/res/layout/activity_example.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/example_layout.xml b/compose/snippets/src/main/res/layout/example_layout.xml index d77d31543..91e49c045 100644 --- a/compose/snippets/src/main/res/layout/example_layout.xml +++ b/compose/snippets/src/main/res/layout/example_layout.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/example_view.xml b/compose/snippets/src/main/res/layout/example_view.xml index 77fff6e8c..86bdacae8 100644 --- a/compose/snippets/src/main/res/layout/example_view.xml +++ b/compose/snippets/src/main/res/layout/example_view.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> diff --git a/compose/snippets/src/main/res/layout/fragment_example.xml b/compose/snippets/src/main/res/layout/fragment_example.xml index fd65463ef..d5517e3c4 100644 --- a/compose/snippets/src/main/res/layout/fragment_example.xml +++ b/compose/snippets/src/main/res/layout/fragment_example.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/interop_layout_preview_composable.xml b/compose/snippets/src/main/res/layout/interop_layout_preview_composable.xml index bb28c5685..b3a672cbe 100644 --- a/compose/snippets/src/main/res/layout/interop_layout_preview_composable.xml +++ b/compose/snippets/src/main/res/layout/interop_layout_preview_composable.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/migration_strategy_existing_screens.xml b/compose/snippets/src/main/res/layout/migration_strategy_existing_screens.xml index 2ef7e2dcb..a7bd893b7 100644 --- a/compose/snippets/src/main/res/layout/migration_strategy_existing_screens.xml +++ b/compose/snippets/src/main/res/layout/migration_strategy_existing_screens.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/migration_strategy_xml_example.xml b/compose/snippets/src/main/res/layout/migration_strategy_xml_example.xml index ac462f26c..e5ed1b289 100644 --- a/compose/snippets/src/main/res/layout/migration_strategy_xml_example.xml +++ b/compose/snippets/src/main/res/layout/migration_strategy_xml_example.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/my_container_view.xml b/compose/snippets/src/main/res/layout/my_container_view.xml index 4d0ecb396..cec8feedc 100644 --- a/compose/snippets/src/main/res/layout/my_container_view.xml +++ b/compose/snippets/src/main/res/layout/my_container_view.xml @@ -1,21 +1,21 @@ + + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/my_fragment_layout.xml b/compose/snippets/src/main/res/layout/my_fragment_layout.xml index d2428b777..3b0ec2765 100644 --- a/compose/snippets/src/main/res/layout/my_fragment_layout.xml +++ b/compose/snippets/src/main/res/layout/my_fragment_layout.xml @@ -1,24 +1,23 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/layout/touchinput_gestures_nested_scroll_interop.xml b/compose/snippets/src/main/res/layout/touchinput_gestures_nested_scroll_interop.xml index bbc6128e7..229f37a13 100644 --- a/compose/snippets/src/main/res/layout/touchinput_gestures_nested_scroll_interop.xml +++ b/compose/snippets/src/main/res/layout/touchinput_gestures_nested_scroll_interop.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 0b0b5355c..05f11b4d6 100644 --- a/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,22 +1,21 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 0b0b5355c..05f11b4d6 100644 --- a/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/compose/snippets/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,22 +1,21 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/values-es/strings.xml b/compose/snippets/src/main/res/values-es/strings.xml index 3ba327f49..7287beb35 100644 --- a/compose/snippets/src/main/res/values-es/strings.xml +++ b/compose/snippets/src/main/res/values-es/strings.xml @@ -1,19 +1,19 @@ + + Copyright 2023 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. +--> snippets Golden Retriever in fall leaves @@ -53,4 +53,4 @@ Compras Perfil Esto es sólo un texto de marcador de posición. - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/values/colors.xml b/compose/snippets/src/main/res/values/colors.xml index 0205675f4..55242e03e 100644 --- a/compose/snippets/src/main/res/values/colors.xml +++ b/compose/snippets/src/main/res/values/colors.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> #FFBB86FC #FF6200EE @@ -25,4 +24,4 @@ #FFFFFFFF #FFF #FFF - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/values/dimens.xml b/compose/snippets/src/main/res/values/dimens.xml index d8dec0639..99c6f584a 100644 --- a/compose/snippets/src/main/res/values/dimens.xml +++ b/compose/snippets/src/main/res/values/dimens.xml @@ -1,20 +1,19 @@ + Copyright 2023 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. +--> 8dp - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/values/ids.xml b/compose/snippets/src/main/res/values/ids.xml index f97cf8a5b..6cc94fcf1 100644 --- a/compose/snippets/src/main/res/values/ids.xml +++ b/compose/snippets/src/main/res/values/ids.xml @@ -1,23 +1,22 @@ + Copyright 2023 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. +--> - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/values/strings.xml b/compose/snippets/src/main/res/values/strings.xml index 02254e29a..d4b9a63a6 100644 --- a/compose/snippets/src/main/res/values/strings.xml +++ b/compose/snippets/src/main/res/values/strings.xml @@ -1,19 +1,19 @@ + + Copyright 2023 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. +--> snippets Golden Retriever in fall leaves @@ -55,4 +55,4 @@ This is just a placeholder. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - \ No newline at end of file + diff --git a/compose/snippets/src/main/res/values/themes.xml b/compose/snippets/src/main/res/values/themes.xml index 3d9f463cd..9e7318559 100644 --- a/compose/snippets/src/main/res/values/themes.xml +++ b/compose/snippets/src/main/res/values/themes.xml @@ -1,21 +1,20 @@ + Copyright 2023 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. +-->