Skip to content

Commit c4096d2

Browse files
compose-devrel-github-botriggarooMagicalMeghan
authored
🤖 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]>
1 parent ecfd991 commit c4096d2

File tree

17 files changed

+97
-182
lines changed

17 files changed

+97
-182
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
- uses: actions/checkout@v4
3333
with:
3434
token: ${{ secrets.PAT || github.token }}
35-
- name: set up Java 17
35+
- name: set up Java 25
3636
uses: actions/setup-java@v4
3737
with:
3838
distribution: 'zulu'
39-
java-version: '17'
39+
java-version: '25'
4040
- name: Build All
4141
run: ./gradlew build --stacktrace
4242
- name: Build Watch Face Push validation snippets

build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.codehaus.groovy.runtime.DefaultGroovyMethods.step
2+
import org.jetbrains.kotlin.gradle.internal.builtins.StandardNames.FqNames.target
3+
14
// Top-level build file where you can add configuration options common to all sub-projects/modules.
25
plugins {
36
alias(libs.plugins.gradle.versions)
@@ -85,7 +88,7 @@ allprojects {
8588
}
8689
kotlinGradle {
8790
target("**/*.kts")
88-
targetExclude("**/build/**/*.kts")
91+
targetExclude("**/build/**/*.kts", "spotless/**/*.kts")
8992
// Look for the first line that doesn't have a block comment (assumed to be the license)
9093
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
9194
}

compose/snippets/src/main/java/com/example/compose/snippets/components/AppBar.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ fun CenterAlignedTopAppBarExample() {
218218

219219
topBar = {
220220
CenterAlignedTopAppBar(
221-
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
221+
colors = TopAppBarDefaults.topAppBarColors(
222222
containerColor = MaterialTheme.colorScheme.primaryContainer,
223223
titleContentColor = MaterialTheme.colorScheme.primary,
224224
),
@@ -431,6 +431,7 @@ fun AppBarSelectionActions(
431431
}
432432
}
433433
},
434+
modifier = modifier
434435
)
435436
}
436437
// [END android_compose_components_appbarselectionactions]
@@ -454,6 +455,7 @@ private fun AppBarMultiSelectionExample(
454455
var selectedItems by rememberSaveable { mutableStateOf(setOf<Int>()) }
455456

456457
Scaffold(
458+
modifier = modifier,
457459
topBar = { AppBarSelectionActions(selectedItems) }
458460
) { innerPadding ->
459461
LazyColumn(contentPadding = innerPadding) {
@@ -517,7 +519,8 @@ fun LazyListMultiSelection(
517519
) {
518520
var selectedItems by rememberSaveable { mutableStateOf(setOf<Int>()) }
519521

520-
LazyColumn(contentPadding = contentPadding) {
522+
LazyColumn(modifier = modifier,
523+
contentPadding = contentPadding) {
521524
itemsIndexed(listItems) { _, index ->
522525
val selected = selectedItems.contains(index)
523526
ListItemSelectable(

compose/snippets/src/main/java/com/example/compose/snippets/components/DatePickers.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ import androidx.compose.ui.input.pointer.pointerInput
5757
import androidx.compose.ui.tooling.preview.Preview
5858
import androidx.compose.ui.unit.dp
5959
import androidx.compose.ui.window.Popup
60-
import com.example.compose.snippets.touchinput.userinteractions.MyAppTheme
60+
import com.example.compose.snippets.ui.theme.SnippetsTheme
6161
import java.text.SimpleDateFormat
6262
import java.util.Date
6363
import java.util.Locale
6464

6565
@Preview
6666
@Composable
6767
private fun DatePickerPreview() {
68-
MyAppTheme {
68+
SnippetsTheme {
6969
DatePickerExamples()
7070
}
7171
}

compose/snippets/src/main/java/com/example/compose/snippets/components/PullToRefreshBox.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
3636
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.Indicator
3737
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.PositionalThreshold
3838
import androidx.compose.material3.pulltorefresh.PullToRefreshState
39-
import androidx.compose.material3.pulltorefresh.pullToRefreshIndicator
39+
import androidx.compose.material3.pulltorefresh.pullToRefresh
4040
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
4141
import androidx.compose.runtime.Composable
4242
import androidx.compose.runtime.getValue
@@ -187,11 +187,13 @@ fun MyCustomIndicator(
187187
modifier: Modifier = Modifier,
188188
) {
189189
Box(
190-
modifier = modifier.pullToRefreshIndicator(
190+
modifier = modifier.pullToRefresh(
191191
state = state,
192192
isRefreshing = isRefreshing,
193-
containerColor = PullToRefreshDefaults.containerColor,
194-
threshold = PositionalThreshold
193+
threshold = PositionalThreshold,
194+
onRefresh = {
195+
196+
}
195197
),
196198
contentAlignment = Alignment.Center
197199
) {

compose/snippets/src/main/java/com/example/compose/snippets/components/Tooltips.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ fun AdvancedRichTooltipExample(
166166
}
167167
}
168168
},
169-
caretSize = DpSize(32.dp, 16.dp)
170169
) {
171170
Text(richTooltipText)
172171
}

compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Mdc3ThemeSnippets.kt

Lines changed: 0 additions & 38 deletions
This file was deleted.

compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
5858
import androidx.compose.ui.platform.ComposeView
5959
import androidx.compose.ui.unit.dp
6060
import androidx.fragment.app.Fragment
61-
import androidx.hilt.navigation.compose.hiltViewModel
61+
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
6262
import androidx.lifecycle.ViewModel
6363
import androidx.navigation.NavHostController
6464
import androidx.navigation.compose.NavHost

compose/snippets/src/main/java/com/example/compose/snippets/layouts/FlowLayoutSnippets.kt

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ import androidx.compose.foundation.background
2121
import androidx.compose.foundation.border
2222
import androidx.compose.foundation.layout.Arrangement
2323
import androidx.compose.foundation.layout.Box
24-
import androidx.compose.foundation.layout.ContextualFlowRow
25-
import androidx.compose.foundation.layout.ContextualFlowRowOverflow
26-
import androidx.compose.foundation.layout.ContextualFlowRowOverflowScope
2724
import androidx.compose.foundation.layout.ExperimentalLayoutApi
2825
import androidx.compose.foundation.layout.FlowColumn
2926
import androidx.compose.foundation.layout.FlowRow
@@ -33,22 +30,13 @@ import androidx.compose.foundation.layout.fillMaxSize
3330
import androidx.compose.foundation.layout.fillMaxWidth
3431
import androidx.compose.foundation.layout.height
3532
import androidx.compose.foundation.layout.padding
36-
import androidx.compose.foundation.layout.safeDrawingPadding
3733
import androidx.compose.foundation.layout.size
3834
import androidx.compose.foundation.layout.width
39-
import androidx.compose.foundation.layout.wrapContentHeight
40-
import androidx.compose.foundation.rememberScrollState
4135
import androidx.compose.foundation.shape.RoundedCornerShape
42-
import androidx.compose.foundation.verticalScroll
4336
import androidx.compose.material.ExperimentalMaterialApi
4437
import androidx.compose.material3.FilterChip
4538
import androidx.compose.material3.Text
4639
import androidx.compose.runtime.Composable
47-
import androidx.compose.runtime.getValue
48-
import androidx.compose.runtime.mutableIntStateOf
49-
import androidx.compose.runtime.remember
50-
import androidx.compose.runtime.setValue
51-
import androidx.compose.ui.Alignment
5240
import androidx.compose.ui.Modifier
5341
import androidx.compose.ui.draw.clip
5442
import androidx.compose.ui.graphics.Color
@@ -465,48 +453,6 @@ fun FlowLayout_FractionalSizing() {
465453
// [END android_compose_flow_layout_fractional_sizing]
466454
}
467455

468-
@OptIn(ExperimentalLayoutApi::class)
469-
@Preview
470-
@Composable
471-
fun ContextualFlowLayoutExample() {
472-
// [START android_compose_layouts_contextual_flow]
473-
val totalCount = 40
474-
var maxLines by remember {
475-
mutableIntStateOf(2)
476-
}
477-
478-
val moreOrCollapseIndicator = @Composable { scope: ContextualFlowRowOverflowScope ->
479-
val remainingItems = totalCount - scope.shownItemCount
480-
ChipItem(if (remainingItems == 0) "Less" else "+$remainingItems", onClick = {
481-
if (remainingItems == 0) {
482-
maxLines = 2
483-
} else {
484-
maxLines += 5
485-
}
486-
})
487-
}
488-
ContextualFlowRow(
489-
modifier = Modifier
490-
.safeDrawingPadding()
491-
.fillMaxWidth(1f)
492-
.padding(16.dp)
493-
.wrapContentHeight(align = Alignment.Top)
494-
.verticalScroll(rememberScrollState()),
495-
verticalArrangement = Arrangement.spacedBy(4.dp),
496-
horizontalArrangement = Arrangement.spacedBy(8.dp),
497-
maxLines = maxLines,
498-
overflow = ContextualFlowRowOverflow.expandOrCollapseIndicator(
499-
minRowsToShowCollapse = 4,
500-
expandIndicator = moreOrCollapseIndicator,
501-
collapseIndicator = moreOrCollapseIndicator
502-
),
503-
itemCount = totalCount
504-
) { index ->
505-
ChipItem("Item $index")
506-
}
507-
// [END android_compose_layouts_contextual_flow]
508-
}
509-
510456
@OptIn(ExperimentalLayoutApi::class)
511457
@Preview
512458
@Composable

compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ import androidx.compose.foundation.shape.RoundedCornerShape
5050
import androidx.compose.material3.Button
5151
import androidx.compose.material3.Card
5252
import androidx.compose.material3.MaterialTheme
53+
import androidx.compose.material3.PrimaryTabRow
5354
import androidx.compose.material3.Tab
54-
import androidx.compose.material3.TabRow
5555
import androidx.compose.material3.Text
5656
import androidx.compose.runtime.Composable
5757
import androidx.compose.runtime.LaunchedEffect
@@ -239,7 +239,7 @@ fun PagerWithTabsExample() {
239239
pages.size
240240
})
241241

242-
TabRow(
242+
PrimaryTabRow(
243243
// Our selected tab is our current page
244244
selectedTabIndex = pagerState.currentPage,
245245
) {

0 commit comments

Comments
 (0)