diff --git a/CanonicalLayouts/supporting-pane-compose/app/build.gradle b/CanonicalLayouts/supporting-pane-compose/app/build.gradle index 743b34eca..9eaa7ded1 100644 --- a/CanonicalLayouts/supporting-pane-compose/app/build.gradle +++ b/CanonicalLayouts/supporting-pane-compose/app/build.gradle @@ -17,7 +17,7 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' - id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" + id("org.jetbrains.kotlin.plugin.compose") version "2.0.20" } @@ -68,19 +68,19 @@ composeCompiler { } dependencies { - def composeBom = platform('androidx.compose:compose-bom:2024.09.00') + def composeBom = platform('androidx.compose:compose-bom:2024.11.00') implementation(composeBom) - implementation 'androidx.core:core-ktx:1.13.1' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.5' - implementation 'androidx.activity:activity-compose:1.9.2' + implementation 'androidx.core:core-ktx:1.15.0' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7' + implementation 'androidx.activity:activity-compose:1.9.3' implementation "androidx.compose.ui:ui" implementation "androidx.compose.ui:ui-tooling-preview" implementation "androidx.window:window:1.3.0" - implementation 'androidx.compose.material3:material3:1.3.0' - implementation 'androidx.compose.material3.adaptive:adaptive:1.1.0-alpha02' - implementation 'androidx.compose.material3.adaptive:adaptive-layout:1.1.0-alpha02' - implementation 'androidx.compose.material3.adaptive:adaptive-navigation:1.1.0-alpha02' - implementation "androidx.compose.material3:material3-window-size-class:1.3.0" + implementation 'androidx.compose.material3:material3:1.4.0-alpha04' + implementation 'androidx.compose.material3.adaptive:adaptive:1.1.0-alpha07' + implementation 'androidx.compose.material3.adaptive:adaptive-layout:1.1.0-alpha07' + implementation 'androidx.compose.material3.adaptive:adaptive-navigation:1.1.0-alpha07' + implementation "androidx.compose.material3:material3-window-size-class:1.3.1" testImplementation 'junit:junit:4.13.2' } \ No newline at end of file diff --git a/CanonicalLayouts/supporting-pane-compose/app/src/main/java/com/example/supportingpanecompose/ui/SupportingPaneSample.kt b/CanonicalLayouts/supporting-pane-compose/app/src/main/java/com/example/supportingpanecompose/ui/SupportingPaneSample.kt index 18fa78ce1..a0748589f 100644 --- a/CanonicalLayouts/supporting-pane-compose/app/src/main/java/com/example/supportingpanecompose/ui/SupportingPaneSample.kt +++ b/CanonicalLayouts/supporting-pane-compose/app/src/main/java/com/example/supportingpanecompose/ui/SupportingPaneSample.kt @@ -18,6 +18,7 @@ package com.example.supportingpanecompose.ui import androidx.activity.compose.BackHandler import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize @@ -25,11 +26,12 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.material3.LocalMinimumInteractiveComponentSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text +import androidx.compose.material3.VerticalDragHandle import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi import androidx.compose.material3.adaptive.layout.AnimatedPane -import androidx.compose.material3.adaptive.layout.PaneExpansionDragHandle import androidx.compose.material3.adaptive.layout.SupportingPaneScaffold import androidx.compose.material3.adaptive.layout.SupportingPaneScaffoldRole import androidx.compose.material3.adaptive.layout.rememberPaneExpansionState @@ -37,14 +39,16 @@ import androidx.compose.material3.adaptive.navigation.rememberSupportingPaneScaf import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.example.supportingpanecompose.R +import kotlinx.coroutines.launch // Create some simple sample data private val data = mapOf( @@ -61,9 +65,12 @@ private val data = mapOf( fun SupportingPaneSample() { var selectedTopic: String by rememberSaveable { mutableStateOf(data.keys.first()) } val navigator = rememberSupportingPaneScaffoldNavigator() + val scope = rememberCoroutineScope() BackHandler(enabled = navigator.canNavigateBack()) { - navigator.navigateBack() + scope.launch { + navigator.navigateBack() + } } SupportingPaneScaffold( @@ -92,7 +99,9 @@ fun SupportingPaneSample() { .clickable { selectedTopic = relatedTopic if (navigator.canNavigateBack()) { - navigator.navigateBack() + scope.launch { + navigator.navigateBack() + } } } ) { @@ -120,7 +129,9 @@ fun SupportingPaneSample() { .fillMaxWidth() .padding(all = 8.dp) .clickable { - navigator.navigateTo(SupportingPaneScaffoldRole.Supporting) + scope.launch { + navigator.navigateTo(SupportingPaneScaffoldRole.Supporting) + } }, contentAlignment = Alignment.Center ) { @@ -134,6 +145,15 @@ fun SupportingPaneSample() { }, paneExpansionState = rememberPaneExpansionState(navigator.scaffoldValue), paneExpansionDragHandle = { state -> - PaneExpansionDragHandle(state, Color.Red) + val interactionSource = + remember { MutableInteractionSource() } + VerticalDragHandle( + modifier = + Modifier.paneExpansionDraggable( + state, + LocalMinimumInteractiveComponentSize.current, + interactionSource + ), interactionSource = interactionSource + ) }) } diff --git a/CanonicalLayouts/supporting-pane-compose/build.gradle b/CanonicalLayouts/supporting-pane-compose/build.gradle index c54adb6cb..b03e2f384 100644 --- a/CanonicalLayouts/supporting-pane-compose/build.gradle +++ b/CanonicalLayouts/supporting-pane-compose/build.gradle @@ -14,7 +14,7 @@ * limitations under the License. */ plugins { - id 'com.android.application' version '8.6.0' apply false - id 'com.android.library' version '8.6.0' apply false - id 'org.jetbrains.kotlin.android' version '2.0.0' apply false + id 'com.android.application' version '8.7.3' apply false + id 'com.android.library' version '8.7.3' apply false + id 'org.jetbrains.kotlin.android' version '2.0.20' apply false } diff --git a/CanonicalLayouts/supporting-pane-compose/gradle/wrapper/gradle-wrapper.properties b/CanonicalLayouts/supporting-pane-compose/gradle/wrapper/gradle-wrapper.properties index f9f3c8cbd..839d03c2d 100644 --- a/CanonicalLayouts/supporting-pane-compose/gradle/wrapper/gradle-wrapper.properties +++ b/CanonicalLayouts/supporting-pane-compose/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed May 25 14:11:15 UTC 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME