Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
03e2b27
Refactor swipe-to-dismiss examples (#486)
JolandaVerhoef Apr 29, 2025
da3ebb8
Update accessibility snippets (#508)
simona-anomis May 1, 2025
432ff04
Migrate XR snippets to alpha04 (#509)
devbridie May 8, 2025
222fd4f
🤖 Update Dependencies (#511)
compose-devrel-github-bot May 8, 2025
187d70f
Adding snippet for MV-HEVC video playback (#513)
vad710 May 8, 2025
3f4d4ad
Update to 1.5.0-beta01 (#514)
kul3r4 May 12, 2025
21896a6
Fix package name (#515)
kul3r4 May 12, 2025
70285ac
Fix scrollState for List and expand the snippet to show more code for…
kul3r4 May 13, 2025
903fcbc
Properly handle recycling of RecomposeHighlighterModifier (#510)
mlykotom May 14, 2025
f6e899c
State based TF snippets (#520)
MagicalMeghan May 15, 2025
9d62789
Icon button snippets (#512)
wardlauren May 15, 2025
cd2e0c1
Updates to ResizableComponent (#516)
vad710 May 16, 2025
4c55c0d
Update migration snippet (#524)
MagicalMeghan May 16, 2025
a9a6a55
Add state based Autofill snippets (#525)
MagicalMeghan May 16, 2025
ce81ef6
Update StateBasedText snippets (#526)
MagicalMeghan May 19, 2025
8f703cc
Add snippets for XR alpha04 hands (#530)
devbridie May 22, 2025
7f4c676
Change XR SceneViewer intent setup (#531)
devbridie May 23, 2025
7230f05
Fix for #533 animated CircleNode modifier (#534)
IanGClifton Jun 12, 2025
f34038d
updating setSubspaceContent snippet (#543)
amyZepp Jun 12, 2025
b198bf0
Update android_system_bar_protection_kotlin to change alpha (#544)
ashnohe Jun 17, 2025
d0ef8d0
Fix Drag&Drop code to also support external apps (#546)
tiwiz Jun 18, 2025
3fbcdcb
Add tile interaction snippets (#547)
ithinkihaveacat Jun 18, 2025
a37e651
Add comment to clarify that both callbacks can be used (#548)
tiwiz Jun 18, 2025
88d1bd6
Add snippets for Android Wear's Always On doc (#549)
ithinkihaveacat Jun 20, 2025
592ac88
Add android_wear_m3_interaction_loadaction_request tag (#551)
ithinkihaveacat Jun 20, 2025
5723c5a
🤖 Update Dependencies (#552)
compose-devrel-github-bot Jun 23, 2025
81b5d86
Move END tag to correct location (#553)
ithinkihaveacat Jun 24, 2025
cafc3dd
Snippets for some Wear OS Tile pages (#554)
ithinkihaveacat Jun 25, 2025
c9e37f8
Adds Watch Face Push validation library snippet (#555)
garanj Jun 27, 2025
a9464f2
Update build.yml to add Watch Face Push validation (#556)
garanj Jun 27, 2025
327c0ac
Typo fix - one import per line (#557)
asolovay Jun 30, 2025
ef79bd2
Update webview url (#559)
cy245 Jul 2, 2025
0c23312
Add additional credman webview snippet and autofill snippets (#561)
cy245 Jul 8, 2025
80802cb
Add remaining autofill snippet with edittext (#562)
cy245 Jul 9, 2025
33c4bc2
Fix rethrowing cancellation exceptions (#563)
mlykotom Jul 11, 2025
341dbd4
Add profiling manager snippets for how-to-capture DAC docs (#568)
edgararriagag Jul 16, 2025
b78993d
Update XR snippets to be compatible with alpha05 versions of the libr…
devbridie Jul 31, 2025
1b043a4
Add example of Lottie animation (#572)
ithinkihaveacat Aug 1, 2025
c703008
Fixing compile error in DeviceCompatibilityModeTestJavaSnippets (#575)
asolovay Aug 5, 2025
f8abcf7
Add Glance in-app widget pinning snippet (#580)
ashnohe Aug 6, 2025
f643874
Revised snippets for consistency. (#579)
JonEckenrode Aug 8, 2025
a87b076
Resolve build failures so repository will build with `./gradlew clean…
cartland Aug 11, 2025
79a26f9
Adding code snippets for wake locks doc (#582)
asolovay Aug 12, 2025
910e372
Breaking long line in code snippet (#586)
asolovay Aug 13, 2025
d1b418e
Add PreloadManager snippets, and update media3 to 1.8.0 (#574)
asolovay Aug 13, 2025
39218cc
Enable spotless on all modules (#587)
cartland Aug 18, 2025
f11b3bc
Build: Increase Gradle JVM heap size to 4g (#595)
cartland Aug 21, 2025
982ea5e
🤖 Update Dependencies (#596)
compose-devrel-github-bot Aug 21, 2025
97d93a1
Adds complications snippets (#597)
garanj Aug 22, 2025
dd30aee
Wear complications (#598)
garanj Aug 22, 2025
41d2e50
Update comments in MyComplicationDataSourceService.kt, visible in And…
khufdev Aug 26, 2025
32e681d
Fix typo for Activity constant (CANCELLED -> CANCELED) (#606)
khufdev Aug 26, 2025
5673ffc
Add lottie animation fallback example (#608)
ithinkihaveacat Aug 26, 2025
7a0ebbe
Update comments in complication part of AndroidManifest.xml (#605)
khufdev Aug 27, 2025
fcea14b
Add padding to avoid overwriting TimeText (#529)
ithinkihaveacat Aug 28, 2025
3c8b283
Refactor(SearchBar): Reorder modifier parameter to follow convention …
cartland Aug 29, 2025
a73d3b4
Refactor(text): Use KTX extension for isDigitsOnly check (#593)
cartland Aug 29, 2025
d6d74ed
Refactor: Rename Composable functions to follow naming conventions (#…
cartland Aug 29, 2025
959474f
Lint: Use specialized state holders to avoid autoboxing (#591)
cartland Aug 29, 2025
e2de07a
Fix(gestures): Handle pointer events inside awaitPointerEventScope (#…
cartland Aug 29, 2025
f95ab59
Fix: Prevent memory leak from implicit SAM conversion (#588)
cartland Aug 29, 2025
6301d76
docs(modifiers): Add TODOs for inspectableProperties lint warnings (#…
cartland Aug 30, 2025
fb85817
Add KMP ViewModel snippets (#611)
mlykotom Sep 1, 2025
e4396f6
Fix missing snippet (#612)
mlykotom Sep 1, 2025
7a69216
Add viewmodel screen for KMP (#613)
mlykotom Sep 3, 2025
a75378c
Add android_wear_tile_version_fallback (#614)
ithinkihaveacat Sep 3, 2025
3d5181b
Disabling some "unused" warnings (#610)
asolovay Sep 3, 2025
30ed522
Resolve warnings in the Wakelock code snippets (#615)
asolovay Sep 5, 2025
89ecf71
Migrate snippets from dac/training/wearables/tiles/screen-size (#617)
ithinkihaveacat Sep 10, 2025
9efabdd
add WindowInsetsRulers snippet (#616)
ashnohe Sep 10, 2025
9436a8d
Update state based (#619)
MagicalMeghan Sep 11, 2025
292ef1d
Update the wear preview code
ithinkihaveacat Sep 11, 2025
73e600d
Adding shadows code snippets (#620)
wardlauren Sep 11, 2025
1da1d9d
Add basic WindowInsetsRulers cases (#621)
ashnohe Sep 16, 2025
2f246fb
Update XR snippets to be compatible with the September release versio…
devbridie Sep 26, 2025
c2e40ee
Upgrade to Gradle wrapper version 9.1.0 (#627)
devbridie Sep 26, 2025
27c462c
Upgrade to Spotless 7 (#628)
devbridie Sep 26, 2025
e8e51b3
add Glance unit testing snippet (#634)
ashnohe Sep 29, 2025
0ce9349
Add incorrectly removed SessionConfigureConfigurationNotSupported (#638)
devbridie Oct 3, 2025
3e4a6ce
Create snippets for Wear's ongoing activities
ithinkihaveacat Oct 7, 2025
ecfd991
Apply Spotless to root project and exclude spotless dir (#636)
cartland Oct 7, 2025
c4096d2
🤖 Update Dependencies (#623)
compose-devrel-github-bot Oct 7, 2025
5f1fd02
add widgets metrics api snippet (#641)
ashnohe Oct 8, 2025
73156c1
Adds snippets for Audio page (#647)
kul3r4 Oct 8, 2025
bd5988f
Add horizontal pager (#650)
kul3r4 Oct 9, 2025
9d96957
Fix incorrect rendering in Volume.kt (#651)
devbridie Oct 9, 2025
8d7da46
🤖 Update Dependencies (#653)
compose-devrel-github-bot Oct 9, 2025
3507dfb
add closing curly brackets to navigation (#654)
kul3r4 Oct 10, 2025
fcf8a03
Add location snippet (#652)
kul3r4 Oct 10, 2025
6c67e34
Adds snippets for hardware buttons (#655)
kul3r4 Oct 13, 2025
7f45bcf
Add Gemini Developer API code snippets (#649)
cartland Oct 14, 2025
75fbe7c
Add new sample for Navigation Suite Scaffold icon alignment (#635)
tiwiz Oct 15, 2025
3d8d466
Remove project code style configuration (#661)
cartland Oct 17, 2025
8a28727
feat: adds close button to supporting pane sample. (#660)
telpirion Oct 20, 2025
afffc04
This PR contains Snippets that will be hosted in the New Visibility A…
srikrishnasakunia Oct 22, 2025
cfdb6a9
Fix flash image model and add remaining Imagen image editing snippets…
cartland Oct 22, 2025
c8dfc10
Minor updates to snippets for doc restructuring (#665)
vinishavathwani Oct 23, 2025
1af16bc
Update to October release of XR libraries (#669)
devbridie Oct 23, 2025
08d7f7e
Resolve ambiguity for Color with named imports (#670)
cartland Oct 23, 2025
0a80c6c
Fix: use application context for content resolver (#671)
cartland Oct 24, 2025
738c35e
Rename workflow from 'Build snippets' to 'Build iOS snippets' (#673)
cartland Oct 27, 2025
977c8e0
🤖 Update Dependencies (#675)
compose-devrel-github-bot Oct 27, 2025
3759291
Add a new project for DataStore (#663)
ralstondasilva Oct 28, 2025
b90686d
Refactor Fragment-in-Compose snippet to use AndroidFragment (#676)
jbw0033 Oct 28, 2025
ca6cdec
Fix bug in usage of END_EXCLUDE (#679)
ralstondasilva Oct 29, 2025
2489cb2
feat(scalable content): add code snippets (#656)
juchengchou Nov 3, 2025
3d85dfd
Update webview snippet to native implementation (#682)
cy245 Nov 5, 2025
49323f3
Update sample url to Sesame server (#685)
cy245 Nov 5, 2025
36730f7
feat: adds close button to list-and-detail pane sample. (#683)
telpirion Nov 6, 2025
43ac10f
Add snippets for /training/wearables/always-on (#691)
ithinkihaveacat Nov 13, 2025
75fbf5b
Snippets for /training/wearables/apps/splash-screen (#692)
ithinkihaveacat Nov 14, 2025
c54efa0
Attempt to fix rendering error (#693)
ithinkihaveacat Nov 14, 2025
07fc354
Add snippets for /training/wearables/tiles/debug (#694)
ithinkihaveacat Nov 14, 2025
c3472d3
Snippets for /training/wearables/data/data-items (#696)
ithinkihaveacat Nov 19, 2025
afe04dd
Snippets for /training/wearables/tiles/dynamic (#695)
ithinkihaveacat Nov 19, 2025
89b0781
Add snippets for /training/wearables/data/{sync,events} (#697)
ithinkihaveacat Nov 19, 2025
906dee1
Add snippets for /training/wearables/tiles/get_started (#698)
ithinkihaveacat Nov 20, 2025
a015aef
Add snippets for /training/wearables/tiles/versioning (#699)
ithinkihaveacat Nov 20, 2025
d60730e
Add snippets for trigger based profiling section of ProfilingManager …
edgararriagag Nov 20, 2025
4b94445
Fix typo (#701)
ithinkihaveacat Nov 21, 2025
652b999
Update Snippet to also support L and XL WSC (#702)
tiwiz Nov 24, 2025
940d737
Snippets for /training/wearables/tiles/get_started?version=3 (#704)
ithinkihaveacat Nov 25, 2025
95aeebd
Improve namespacing and clarity (#705)
ithinkihaveacat Nov 25, 2025
2ad986a
Merge remote-tracking branch 'origin/main' into latest
compose-devrel-github-bot Nov 25, 2025
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
Prev Previous commit
Next Next commit
🤖 Update Dependencies (#623)
* 🤖 Update Dependencies

* Change :views module to point to mdkSdk 36

* Change XR module to use targetSdk and compileSdk from central libs file.

* Update to java v25

* Refactor: Update Compose snippets and dependencies

This commit includes the following changes:

- Updated various Compose snippets to align with recent API changes:
    - Replaced `Mdc3Theme` with standard Material 3 Theming.
    - Removed `LocalUseFallbackRippleImplementation` as its not available in latest versions.
    - Replaced `Divider` with `HorizontalDivider`.
    - Updated `ClickableText` to use `Text` with a `clickable` modifier.
    - Removed `ContextualFlowLayoutExample` as `ContextualFlowRow` is deprecated.
    - Updated `pullToRefreshIndicator` to `pullToRefresh`.
    - Removed `caretSize` from `TooltipBox` as it is no longer available.
    - Replaced `TabRow` with `PrimaryTabRow`.
- Updated Gradle wrapper to version 9.1.0.
- Updated various library versions in `libs.versions.toml`, including `androidx-xr` libraries.
- Corrected import for `hiltViewModel`.

* 🤖 Update Dependencies

* Update views compileSdk

* Update compile Sdk to 36

* Update gradle-wrapper.properties

* Update gradle-wrapper.properties

* add ktlint back

* update xr

* exclude copyright folder

* Fix java versions.

* Fix watchface push

---------

Co-authored-by: Rebecca Franks <[email protected]>
Co-authored-by: Meghan <[email protected]>
  • Loading branch information
3 people authored Oct 7, 2025
commit c4096d2f95c497da62c0c955bda4186e7ac79d2a
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.codehaus.groovy.runtime.DefaultGroovyMethods.step
import org.jetbrains.kotlin.gradle.internal.builtins.StandardNames.FqNames.target

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.gradle.versions)
Expand Down Expand Up @@ -85,7 +88,7 @@ allprojects {
}
kotlinGradle {
target("**/*.kts")
targetExclude("**/build/**/*.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"), "(^(?![\\/ ]\\*).*$)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fun CenterAlignedTopAppBarExample() {

topBar = {
CenterAlignedTopAppBar(
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primaryContainer,
titleContentColor = MaterialTheme.colorScheme.primary,
),
Expand Down Expand Up @@ -431,6 +431,7 @@ fun AppBarSelectionActions(
}
}
},
modifier = modifier
)
}
// [END android_compose_components_appbarselectionactions]
Expand All @@ -454,6 +455,7 @@ private fun AppBarMultiSelectionExample(
var selectedItems by rememberSaveable { mutableStateOf(setOf<Int>()) }

Scaffold(
modifier = modifier,
topBar = { AppBarSelectionActions(selectedItems) }
) { innerPadding ->
LazyColumn(contentPadding = innerPadding) {
Expand Down Expand Up @@ -517,7 +519,8 @@ fun LazyListMultiSelection(
) {
var selectedItems by rememberSaveable { mutableStateOf(setOf<Int>()) }

LazyColumn(contentPadding = contentPadding) {
LazyColumn(modifier = modifier,
contentPadding = contentPadding) {
itemsIndexed(listItems) { _, index ->
val selected = selectedItems.contains(index)
ListItemSelectable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ 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

@Preview
@Composable
private fun DatePickerPreview() {
MyAppTheme {
SnippetsTheme {
DatePickerExamples()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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
Expand Down Expand Up @@ -187,11 +187,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
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ fun AdvancedRichTooltipExample(
}
}
},
caretSize = DpSize(32.dp, 16.dp)
) {
Text(richTooltipText)
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -239,7 +239,7 @@ fun PagerWithTabsExample() {
pages.size
})

TabRow(
PrimaryTabRow(
// Our selected tab is our current page
selectedTabIndex = pagerState.currentPage,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -109,7 +110,7 @@ fun Colors() {
// <color name="purple_200">#FFBB86FC</color>

// In your Compose code
Divider(color = colorResource(R.color.purple_200))
HorizontalDivider(color = colorResource(R.color.purple_200))
// [END android_compose_resources_colors]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
Loading