Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,10 @@ 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 java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

@Preview
@Composable
private fun DatePickerPreview() {
MyAppTheme {
DatePickerExamples()
}
}

// [START android_compose_components_datepicker_examples]
// [START_EXCLUDE]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -187,10 +186,10 @@ fun MyCustomIndicator(
modifier: Modifier = Modifier,
) {
Box(
modifier = modifier.pullToRefreshIndicator(
modifier = modifier.pullToRefresh(
state = state,
isRefreshing = isRefreshing,
containerColor = PullToRefreshDefaults.containerColor,
onRefresh = { /* */ },
threshold = PositionalThreshold
),
contentAlignment = Alignment.Center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fun AdvancedRichTooltipExample(
}
}
},
caretSize = DpSize(32.dp, 16.dp)
caretShape = TooltipDefaults.caretShape(DpSize(32.dp, 16.dp))
) {
Text(richTooltipText)
}
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 @@ -236,32 +235,6 @@ private class ScaleIndicationNode(
}
// [END android_compose_userinteractions_scale_indication_node]

@Composable
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
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ ksp = "2.2.10-2.0.2"
lifecycleService = "2.9.2"
maps-compose = "6.7.2"
material = "1.14.0-alpha03"
material3-adaptive = "1.1.0"
material3-adaptive-navigation-suite = "1.3.2"
material3-adaptive = "1.2.0-beta03"
material3-adaptive-navigation-suite = "1.5.0-alpha04"
media3 = "1.8.0"
# @keep
minSdk = "35"
Expand Down