From 31c4f05872d8fca4a343f720cf5fae84c46bd7a2 Mon Sep 17 00:00:00 2001 From: Rob Orgiu Date: Tue, 7 Jan 2025 17:36:21 +0100 Subject: [PATCH] Simplify Drag&Drop implementation --- .../dependencies/releaseRuntimeClasspath.txt | 100 +++++++++--------- .../prodReleaseRuntimeClasspath.txt | 68 ++++++------ .../nowinandroid/core/ui/NewsResourceCard.kt | 6 +- gradle/libs.versions.toml | 3 +- 4 files changed, 88 insertions(+), 89 deletions(-) diff --git a/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt b/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt index f369816259..4e0b3ef485 100644 --- a/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt +++ b/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt @@ -2,24 +2,24 @@ androidx.activity:activity-compose:1.9.3 androidx.activity:activity-ktx:1.9.3 androidx.activity:activity:1.9.3 androidx.annotation:annotation-experimental:1.4.1 -androidx.annotation:annotation-jvm:1.8.1 -androidx.annotation:annotation:1.8.1 +androidx.annotation:annotation-jvm:1.9.1 +androidx.annotation:annotation:1.9.1 androidx.appcompat:appcompat-resources:1.6.1 androidx.arch.core:core-common:2.2.0 androidx.arch.core:core-runtime:2.2.0 androidx.autofill:autofill:1.0.0 androidx.browser:browser:1.8.0 -androidx.collection:collection-jvm:1.4.4 -androidx.collection:collection-ktx:1.4.4 -androidx.collection:collection:1.4.4 -androidx.compose.animation:animation-android:1.7.6 -androidx.compose.animation:animation-core-android:1.7.6 -androidx.compose.animation:animation-core:1.7.6 -androidx.compose.animation:animation:1.7.6 -androidx.compose.foundation:foundation-android:1.7.6 -androidx.compose.foundation:foundation-layout-android:1.7.6 -androidx.compose.foundation:foundation-layout:1.7.6 -androidx.compose.foundation:foundation:1.7.6 +androidx.collection:collection-jvm:1.5.0-alpha06 +androidx.collection:collection-ktx:1.5.0-alpha06 +androidx.collection:collection:1.5.0-alpha06 +androidx.compose.animation:animation-android:1.8.0-alpha06 +androidx.compose.animation:animation-core-android:1.8.0-alpha06 +androidx.compose.animation:animation-core:1.8.0-alpha06 +androidx.compose.animation:animation:1.8.0-alpha06 +androidx.compose.foundation:foundation-android:1.8.0-alpha06 +androidx.compose.foundation:foundation-layout-android:1.8.0-alpha06 +androidx.compose.foundation:foundation-layout:1.8.0-alpha06 +androidx.compose.foundation:foundation:1.8.0-alpha06 androidx.compose.material3.adaptive:adaptive-android:1.0.0 androidx.compose.material3.adaptive:adaptive:1.0.0 androidx.compose.material3:material3-adaptive-navigation-suite-android:1.3.1 @@ -32,55 +32,55 @@ androidx.compose.material:material-icons-extended-android:1.7.6 androidx.compose.material:material-icons-extended:1.7.6 androidx.compose.material:material-ripple-android:1.7.6 androidx.compose.material:material-ripple:1.7.6 -androidx.compose.runtime:runtime-android:1.7.6 -androidx.compose.runtime:runtime-saveable-android:1.7.6 -androidx.compose.runtime:runtime-saveable:1.7.6 -androidx.compose.runtime:runtime:1.7.6 -androidx.compose.ui:ui-android:1.7.6 -androidx.compose.ui:ui-geometry-android:1.7.6 -androidx.compose.ui:ui-geometry:1.7.6 -androidx.compose.ui:ui-graphics-android:1.7.6 -androidx.compose.ui:ui-graphics:1.7.6 -androidx.compose.ui:ui-text-android:1.7.6 -androidx.compose.ui:ui-text:1.7.6 -androidx.compose.ui:ui-tooling-preview-android:1.7.6 -androidx.compose.ui:ui-tooling-preview:1.7.6 -androidx.compose.ui:ui-unit-android:1.7.6 -androidx.compose.ui:ui-unit:1.7.6 -androidx.compose.ui:ui-util-android:1.7.6 -androidx.compose.ui:ui-util:1.7.6 -androidx.compose.ui:ui:1.7.6 +androidx.compose.runtime:runtime-android:1.8.0-alpha06 +androidx.compose.runtime:runtime-saveable-android:1.8.0-alpha06 +androidx.compose.runtime:runtime-saveable:1.8.0-alpha06 +androidx.compose.runtime:runtime:1.8.0-alpha06 +androidx.compose.ui:ui-android:1.8.0-alpha06 +androidx.compose.ui:ui-geometry-android:1.8.0-alpha06 +androidx.compose.ui:ui-geometry:1.8.0-alpha06 +androidx.compose.ui:ui-graphics-android:1.8.0-alpha06 +androidx.compose.ui:ui-graphics:1.8.0-alpha06 +androidx.compose.ui:ui-text-android:1.8.0-alpha06 +androidx.compose.ui:ui-text:1.8.0-alpha06 +androidx.compose.ui:ui-tooling-preview-android:1.8.0-alpha06 +androidx.compose.ui:ui-tooling-preview:1.8.0-alpha06 +androidx.compose.ui:ui-unit-android:1.8.0-alpha06 +androidx.compose.ui:ui-unit:1.8.0-alpha06 +androidx.compose.ui:ui-util-android:1.8.0-alpha06 +androidx.compose.ui:ui-util:1.8.0-alpha06 +androidx.compose.ui:ui:1.8.0-alpha06 androidx.compose:compose-bom:2024.12.01 androidx.concurrent:concurrent-futures:1.1.0 androidx.core:core-ktx:1.13.1 androidx.core:core:1.13.1 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.0.0 -androidx.emoji2:emoji2:1.3.0 +androidx.emoji2:emoji2:1.4.0 androidx.exifinterface:exifinterface:1.3.7 androidx.fragment:fragment:1.5.1 androidx.graphics:graphics-path:1.0.1 androidx.interpolator:interpolator:1.0.0 -androidx.lifecycle:lifecycle-common-java8:2.8.3 -androidx.lifecycle:lifecycle-common-jvm:2.8.3 -androidx.lifecycle:lifecycle-common:2.8.3 -androidx.lifecycle:lifecycle-livedata-core-ktx:2.8.3 -androidx.lifecycle:lifecycle-livedata-core:2.8.3 -androidx.lifecycle:lifecycle-livedata:2.8.3 -androidx.lifecycle:lifecycle-process:2.8.3 -androidx.lifecycle:lifecycle-runtime-android:2.8.3 -androidx.lifecycle:lifecycle-runtime-compose-android:2.8.3 -androidx.lifecycle:lifecycle-runtime-compose:2.8.3 -androidx.lifecycle:lifecycle-runtime-ktx-android:2.8.3 -androidx.lifecycle:lifecycle-runtime-ktx:2.8.3 -androidx.lifecycle:lifecycle-runtime:2.8.3 -androidx.lifecycle:lifecycle-viewmodel-android:2.8.3 -androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3 -androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.3 -androidx.lifecycle:lifecycle-viewmodel:2.8.3 +androidx.lifecycle:lifecycle-common-java8:2.8.7 +androidx.lifecycle:lifecycle-common-jvm:2.8.7 +androidx.lifecycle:lifecycle-common:2.8.7 +androidx.lifecycle:lifecycle-livedata-core-ktx:2.8.7 +androidx.lifecycle:lifecycle-livedata-core:2.8.7 +androidx.lifecycle:lifecycle-livedata:2.8.7 +androidx.lifecycle:lifecycle-process:2.8.7 +androidx.lifecycle:lifecycle-runtime-android:2.8.7 +androidx.lifecycle:lifecycle-runtime-compose-android:2.8.7 +androidx.lifecycle:lifecycle-runtime-compose:2.8.7 +androidx.lifecycle:lifecycle-runtime-ktx-android:2.8.7 +androidx.lifecycle:lifecycle-runtime-ktx:2.8.7 +androidx.lifecycle:lifecycle-runtime:2.8.7 +androidx.lifecycle:lifecycle-viewmodel-android:2.8.7 +androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7 +androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.7 +androidx.lifecycle:lifecycle-viewmodel:2.8.7 androidx.loader:loader:1.0.0 androidx.metrics:metrics-performance:1.0.0-beta01 -androidx.profileinstaller:profileinstaller:1.3.1 +androidx.profileinstaller:profileinstaller:1.4.0 androidx.savedstate:savedstate-ktx:1.2.1 androidx.savedstate:savedstate:1.2.1 androidx.startup:startup-runtime:1.1.1 diff --git a/app/dependencies/prodReleaseRuntimeClasspath.txt b/app/dependencies/prodReleaseRuntimeClasspath.txt index e334aa6768..f1cafaad0b 100644 --- a/app/dependencies/prodReleaseRuntimeClasspath.txt +++ b/app/dependencies/prodReleaseRuntimeClasspath.txt @@ -2,25 +2,25 @@ androidx.activity:activity-compose:1.9.3 androidx.activity:activity-ktx:1.9.3 androidx.activity:activity:1.9.3 androidx.annotation:annotation-experimental:1.4.1 -androidx.annotation:annotation-jvm:1.8.1 -androidx.annotation:annotation:1.8.1 +androidx.annotation:annotation-jvm:1.9.1 +androidx.annotation:annotation:1.9.1 androidx.appcompat:appcompat-resources:1.7.0 androidx.appcompat:appcompat:1.7.0 androidx.arch.core:core-common:2.2.0 androidx.arch.core:core-runtime:2.2.0 androidx.autofill:autofill:1.0.0 androidx.browser:browser:1.8.0 -androidx.collection:collection-jvm:1.4.4 -androidx.collection:collection-ktx:1.4.4 -androidx.collection:collection:1.4.4 -androidx.compose.animation:animation-android:1.7.6 -androidx.compose.animation:animation-core-android:1.7.6 -androidx.compose.animation:animation-core:1.7.6 -androidx.compose.animation:animation:1.7.6 -androidx.compose.foundation:foundation-android:1.7.6 -androidx.compose.foundation:foundation-layout-android:1.7.6 -androidx.compose.foundation:foundation-layout:1.7.6 -androidx.compose.foundation:foundation:1.7.6 +androidx.collection:collection-jvm:1.5.0-alpha06 +androidx.collection:collection-ktx:1.5.0-alpha06 +androidx.collection:collection:1.5.0-alpha06 +androidx.compose.animation:animation-android:1.8.0-alpha06 +androidx.compose.animation:animation-core-android:1.8.0-alpha06 +androidx.compose.animation:animation-core:1.8.0-alpha06 +androidx.compose.animation:animation:1.8.0-alpha06 +androidx.compose.foundation:foundation-android:1.8.0-alpha06 +androidx.compose.foundation:foundation-layout-android:1.8.0-alpha06 +androidx.compose.foundation:foundation-layout:1.8.0-alpha06 +androidx.compose.foundation:foundation:1.8.0-alpha06 androidx.compose.material3.adaptive:adaptive-android:1.0.0 androidx.compose.material3.adaptive:adaptive-layout-android:1.0.0 androidx.compose.material3.adaptive:adaptive-layout:1.0.0 @@ -39,25 +39,25 @@ androidx.compose.material:material-icons-extended-android:1.7.6 androidx.compose.material:material-icons-extended:1.7.6 androidx.compose.material:material-ripple-android:1.7.6 androidx.compose.material:material-ripple:1.7.6 -androidx.compose.runtime:runtime-android:1.7.6 -androidx.compose.runtime:runtime-saveable-android:1.7.6 -androidx.compose.runtime:runtime-saveable:1.7.6 -androidx.compose.runtime:runtime-tracing:1.7.6 -androidx.compose.runtime:runtime:1.7.6 -androidx.compose.ui:ui-android:1.7.6 -androidx.compose.ui:ui-geometry-android:1.7.6 -androidx.compose.ui:ui-geometry:1.7.6 -androidx.compose.ui:ui-graphics-android:1.7.6 -androidx.compose.ui:ui-graphics:1.7.6 -androidx.compose.ui:ui-text-android:1.7.6 -androidx.compose.ui:ui-text:1.7.6 -androidx.compose.ui:ui-tooling-preview-android:1.7.6 -androidx.compose.ui:ui-tooling-preview:1.7.6 -androidx.compose.ui:ui-unit-android:1.7.6 -androidx.compose.ui:ui-unit:1.7.6 -androidx.compose.ui:ui-util-android:1.7.6 -androidx.compose.ui:ui-util:1.7.6 -androidx.compose.ui:ui:1.7.6 +androidx.compose.runtime:runtime-android:1.8.0-alpha06 +androidx.compose.runtime:runtime-saveable-android:1.8.0-alpha06 +androidx.compose.runtime:runtime-saveable:1.8.0-alpha06 +androidx.compose.runtime:runtime-tracing:1.8.0-alpha06 +androidx.compose.runtime:runtime:1.8.0-alpha06 +androidx.compose.ui:ui-android:1.8.0-alpha06 +androidx.compose.ui:ui-geometry-android:1.8.0-alpha06 +androidx.compose.ui:ui-geometry:1.8.0-alpha06 +androidx.compose.ui:ui-graphics-android:1.8.0-alpha06 +androidx.compose.ui:ui-graphics:1.8.0-alpha06 +androidx.compose.ui:ui-text-android:1.8.0-alpha06 +androidx.compose.ui:ui-text:1.8.0-alpha06 +androidx.compose.ui:ui-tooling-preview-android:1.8.0-alpha06 +androidx.compose.ui:ui-tooling-preview:1.8.0-alpha06 +androidx.compose.ui:ui-unit-android:1.8.0-alpha06 +androidx.compose.ui:ui-unit:1.8.0-alpha06 +androidx.compose.ui:ui-util-android:1.8.0-alpha06 +androidx.compose.ui:ui-util:1.8.0-alpha06 +androidx.compose.ui:ui:1.8.0-alpha06 androidx.compose:compose-bom:2024.12.01 androidx.concurrent:concurrent-futures-ktx:1.1.0 androidx.concurrent:concurrent-futures:1.1.0 @@ -79,8 +79,8 @@ androidx.datastore:datastore-preferences:1.1.1 androidx.datastore:datastore:1.1.1 androidx.documentfile:documentfile:1.0.0 androidx.drawerlayout:drawerlayout:1.0.0 -androidx.emoji2:emoji2-views-helper:1.3.0 -androidx.emoji2:emoji2:1.3.0 +androidx.emoji2:emoji2-views-helper:1.4.0 +androidx.emoji2:emoji2:1.4.0 androidx.exifinterface:exifinterface:1.3.7 androidx.fragment:fragment:1.5.4 androidx.graphics:graphics-path:1.0.1 diff --git a/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCard.kt b/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCard.kt index ff10b8d380..f6e446be06 100644 --- a/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCard.kt +++ b/core/ui/src/main/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCard.kt @@ -138,16 +138,14 @@ fun NewsResourceCardExpanded( userNewsResource.title, modifier = Modifier .fillMaxWidth((.8f)) - .dragAndDropSource { - startTransfer( + .dragAndDropSource { _ -> DragAndDropTransferData( ClipData.newPlainText( sharingLabel, sharingContent, ), flags = dragAndDropFlags, - ), - ) + ) }, ) Spacer(modifier = Modifier.weight(1f)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ce4bd2c644..1936fe5c19 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -57,6 +57,7 @@ room = "2.6.1" secrets = "2.0.1" truth = "1.4.4" turbine = "1.2.0" +composeFoundation = "1.8.0-alpha06" [bundles] androidx-compose-ui-test = ["androidx-compose-ui-test", "androidx-compose-ui-testManifest"] @@ -69,7 +70,7 @@ androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version androidx-benchmark-macro = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "androidxMacroBenchmark" } androidx-browser = { group = "androidx.browser", name = "browser", version.ref = "androidxBrowser" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } -androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } +androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "composeFoundation" } androidx-compose-foundation-layout = { group = "androidx.compose.foundation", name = "foundation-layout" } androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }