diff --git a/README.md b/README.md index be1270b16..1f5270323 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,8 @@ Examples: To run the tests execute the following gradle tasks: -- `testDemoDebug` run all local tests against the `demoDebug` variant. +- `testDemoDebug` run all local tests against the `demoDebug` variant. Screenshot tests will fail +(see below for explanation). To avoid this, run `recordRoborazziDemoDebug` prior to running unit tests. - `connectedDemoDebugAndroidTest` run all instrumented tests against the `demoDebug` variant. **Note:** You should not run `./gradlew test` or `./gradlew connectedAndroidTest` as this will execute @@ -137,7 +138,7 @@ stored in `modulename/src/test/screenshots`. - `compareRoborazziDemoDebug` create comparison images between failed tests and the known correct images. These can also be found in `modulename/src/test/screenshots`. -**Note:** The known correct screenshots stored in this repository are recorded on CI using Linux. Other +**Note on failing screenshot tests:** The known correct screenshots stored in this repository are recorded on CI using Linux. Other platforms may (and probably will) generate slightly different images, making the screenshot tests fail. When working on a non-Linux platform, a workaround to this is to run `recordRoborazziDemoDebug` on the `main` branch before starting work. After making changes, `verifyRoborazziDemoDebug` will identify only diff --git a/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt b/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt index b9135ed42..fcbb409ee 100644 --- a/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt +++ b/app-nia-catalog/dependencies/releaseRuntimeClasspath.txt @@ -20,8 +20,8 @@ androidx.compose.foundation:foundation-android:1.7.0-beta01 androidx.compose.foundation:foundation-layout-android:1.7.0-beta01 androidx.compose.foundation:foundation-layout:1.7.0-beta01 androidx.compose.foundation:foundation:1.7.0-beta01 -androidx.compose.material3.adaptive:adaptive-android:1.0.0-beta01 -androidx.compose.material3.adaptive:adaptive:1.0.0-beta01 +androidx.compose.material3.adaptive:adaptive-android:1.0.0-rc01 +androidx.compose.material3.adaptive:adaptive:1.0.0-rc01 androidx.compose.material3:material3-adaptive-navigation-suite-android:1.3.0-beta01 androidx.compose.material3:material3-adaptive-navigation-suite:1.3.0-beta01 androidx.compose.material3:material3-android:1.3.0-beta01 @@ -91,9 +91,9 @@ androidx.vectordrawable:vectordrawable:1.1.0 androidx.versionedparcelable:versionedparcelable:1.1.1 androidx.viewpager:viewpager:1.0.0 androidx.window.extensions.core:core:1.0.0 -androidx.window:window-core-android:1.3.0-beta02 -androidx.window:window-core:1.3.0-beta02 -androidx.window:window:1.3.0-beta02 +androidx.window:window-core-android:1.3.0-rc01 +androidx.window:window-core:1.3.0-rc01 +androidx.window:window:1.3.0-rc01 com.google.accompanist:accompanist-drawablepainter:0.32.0 com.google.code.findbugs:jsr305:3.0.2 com.google.dagger:dagger-lint-aar:2.51.1 diff --git a/app/dependencies/prodReleaseRuntimeClasspath.txt b/app/dependencies/prodReleaseRuntimeClasspath.txt index b909bcbc9..466058481 100644 --- a/app/dependencies/prodReleaseRuntimeClasspath.txt +++ b/app/dependencies/prodReleaseRuntimeClasspath.txt @@ -1,7 +1,7 @@ androidx.activity:activity-compose:1.8.2 androidx.activity:activity-ktx:1.8.2 androidx.activity:activity:1.8.2 -androidx.annotation:annotation-experimental:1.4.0 +androidx.annotation:annotation-experimental:1.4.1 androidx.annotation:annotation-jvm:1.8.0 androidx.annotation:annotation:1.8.0 androidx.appcompat:appcompat-resources:1.7.0 @@ -13,20 +13,20 @@ androidx.browser:browser:1.8.0 androidx.collection:collection-jvm:1.4.0 androidx.collection:collection-ktx:1.4.0 androidx.collection:collection:1.4.0 -androidx.compose.animation:animation-android:1.7.0-beta01 -androidx.compose.animation:animation-core-android:1.7.0-beta01 -androidx.compose.animation:animation-core:1.7.0-beta01 -androidx.compose.animation:animation:1.7.0-beta01 -androidx.compose.foundation:foundation-android:1.7.0-beta01 -androidx.compose.foundation:foundation-layout-android:1.7.0-beta01 -androidx.compose.foundation:foundation-layout:1.7.0-beta01 -androidx.compose.foundation:foundation:1.7.0-beta01 -androidx.compose.material3.adaptive:adaptive-android:1.0.0-beta01 -androidx.compose.material3.adaptive:adaptive-layout-android:1.0.0-beta01 -androidx.compose.material3.adaptive:adaptive-layout:1.0.0-beta01 -androidx.compose.material3.adaptive:adaptive-navigation-android:1.0.0-beta01 -androidx.compose.material3.adaptive:adaptive-navigation:1.0.0-beta01 -androidx.compose.material3.adaptive:adaptive:1.0.0-beta01 +androidx.compose.animation:animation-android:1.7.0-rc01 +androidx.compose.animation:animation-core-android:1.7.0-rc01 +androidx.compose.animation:animation-core:1.7.0-rc01 +androidx.compose.animation:animation:1.7.0-rc01 +androidx.compose.foundation:foundation-android:1.7.0-rc01 +androidx.compose.foundation:foundation-layout-android:1.7.0-rc01 +androidx.compose.foundation:foundation-layout:1.7.0-rc01 +androidx.compose.foundation:foundation:1.7.0-rc01 +androidx.compose.material3.adaptive:adaptive-android:1.0.0-rc01 +androidx.compose.material3.adaptive:adaptive-layout-android:1.0.0-rc01 +androidx.compose.material3.adaptive:adaptive-layout:1.0.0-rc01 +androidx.compose.material3.adaptive:adaptive-navigation-android:1.0.0-rc01 +androidx.compose.material3.adaptive:adaptive-navigation:1.0.0-rc01 +androidx.compose.material3.adaptive:adaptive:1.0.0-rc01 androidx.compose.material3:material3-adaptive-navigation-suite-android:1.3.0-beta01 androidx.compose.material3:material3-adaptive-navigation-suite:1.3.0-beta01 androidx.compose.material3:material3-android:1.3.0-beta01 @@ -39,25 +39,25 @@ androidx.compose.material:material-icons-extended-android:1.6.3 androidx.compose.material:material-icons-extended:1.6.3 androidx.compose.material:material-ripple-android:1.7.0-beta01 androidx.compose.material:material-ripple:1.7.0-beta01 -androidx.compose.runtime:runtime-android:1.7.0-beta01 -androidx.compose.runtime:runtime-saveable-android:1.7.0-beta01 -androidx.compose.runtime:runtime-saveable:1.7.0-beta01 +androidx.compose.runtime:runtime-android:1.7.0-rc01 +androidx.compose.runtime:runtime-saveable-android:1.7.0-rc01 +androidx.compose.runtime:runtime-saveable:1.7.0-rc01 androidx.compose.runtime:runtime-tracing:1.0.0-beta01 -androidx.compose.runtime:runtime:1.7.0-beta01 -androidx.compose.ui:ui-android:1.7.0-beta01 -androidx.compose.ui:ui-geometry-android:1.7.0-beta01 -androidx.compose.ui:ui-geometry:1.7.0-beta01 -androidx.compose.ui:ui-graphics-android:1.7.0-beta01 -androidx.compose.ui:ui-graphics:1.7.0-beta01 -androidx.compose.ui:ui-text-android:1.7.0-beta01 -androidx.compose.ui:ui-text:1.7.0-beta01 -androidx.compose.ui:ui-tooling-preview-android:1.7.0-beta01 -androidx.compose.ui:ui-tooling-preview:1.7.0-beta01 -androidx.compose.ui:ui-unit-android:1.7.0-beta01 -androidx.compose.ui:ui-unit:1.7.0-beta01 -androidx.compose.ui:ui-util-android:1.7.0-beta01 -androidx.compose.ui:ui-util:1.7.0-beta01 -androidx.compose.ui:ui:1.7.0-beta01 +androidx.compose.runtime:runtime:1.7.0-rc01 +androidx.compose.ui:ui-android:1.7.0-rc01 +androidx.compose.ui:ui-geometry-android:1.7.0-rc01 +androidx.compose.ui:ui-geometry:1.7.0-rc01 +androidx.compose.ui:ui-graphics-android:1.7.0-rc01 +androidx.compose.ui:ui-graphics:1.7.0-rc01 +androidx.compose.ui:ui-text-android:1.7.0-rc01 +androidx.compose.ui:ui-text:1.7.0-rc01 +androidx.compose.ui:ui-tooling-preview-android:1.7.0-rc01 +androidx.compose.ui:ui-tooling-preview:1.7.0-rc01 +androidx.compose.ui:ui-unit-android:1.7.0-rc01 +androidx.compose.ui:ui-unit:1.7.0-rc01 +androidx.compose.ui:ui-util-android:1.7.0-rc01 +androidx.compose.ui:ui-util:1.7.0-rc01 +androidx.compose.ui:ui:1.7.0-rc01 androidx.compose:compose-bom:2024.02.02 androidx.concurrent:concurrent-futures:1.1.0 androidx.core:core-ktx:1.13.1 @@ -132,9 +132,9 @@ androidx.vectordrawable:vectordrawable:1.1.0 androidx.versionedparcelable:versionedparcelable:1.1.1 androidx.viewpager:viewpager:1.0.0 androidx.window.extensions.core:core:1.0.0 -androidx.window:window-core-android:1.3.0-beta02 -androidx.window:window-core:1.3.0-beta02 -androidx.window:window:1.3.0-beta02 +androidx.window:window-core-android:1.3.0-rc01 +androidx.window:window-core:1.3.0-rc01 +androidx.window:window:1.3.0-rc01 androidx.work:work-runtime-ktx:2.9.0 androidx.work:work-runtime:2.9.0 com.caverock:androidsvg-aar:1.4 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 e60c498eb..7c41d74d0 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 @@ -16,8 +16,15 @@ package com.google.samples.apps.nowinandroid.core.ui +import android.content.ClipData +import android.os.Build.VERSION +import android.os.Build.VERSION_CODES +import android.view.View import androidx.compose.foundation.Canvas +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image +import androidx.compose.foundation.draganddrop.dragAndDropSource +import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -45,6 +52,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draganddrop.DragAndDropTransferData import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalInspectionMode @@ -77,6 +85,7 @@ import java.util.Locale * [NewsResource] card used on the following screens: For You, Saved */ +@OptIn(ExperimentalFoundationApi::class) @Composable fun NewsResourceCardExpanded( userNewsResource: UserNewsResource, @@ -88,6 +97,19 @@ fun NewsResourceCardExpanded( modifier: Modifier = Modifier, ) { val clickActionLabel = stringResource(R.string.core_ui_card_tap_action) + val sharingLabel = stringResource(R.string.core_ui_feed_sharing) + val sharingContent = stringResource( + R.string.core_ui_feed_sharing_data, + userNewsResource.title, + userNewsResource.url, + ) + + val dragAndDropFlags = if (VERSION.SDK_INT >= VERSION_CODES.N) { + View.DRAG_FLAG_GLOBAL + } else { + 0 + } + Card( onClick = onClick, shape = RoundedCornerShape(16.dp), @@ -112,7 +134,23 @@ fun NewsResourceCardExpanded( Row { NewsResourceTitle( userNewsResource.title, - modifier = Modifier.fillMaxWidth((.8f)), + modifier = Modifier + .fillMaxWidth((.8f)) + .dragAndDropSource { + detectTapGestures( + onLongPress = { + startTransfer( + DragAndDropTransferData( + ClipData.newPlainText( + sharingLabel, + sharingContent, + ), + flags = dragAndDropFlags, + ), + ) + }, + ) + }, ) Spacer(modifier = Modifier.weight(1f)) BookmarkButton(isBookmarked, onToggleBookmark) diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index ab76748ef..a97746a9c 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -29,4 +29,6 @@ Follow interest Unfollow interest + Feed sharing + %1$s: %2$s diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5946bc447..9f2c83138 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ androidxAppCompat = "1.7.0" androidxBrowser = "1.8.0" androidxComposeAlpha = "1.7.0-beta01" androidxComposeBom = "2024.02.02" -androidxComposeMaterial3Adaptive = "1.0.0-beta01" +androidxComposeMaterial3Adaptive = "1.0.0-rc01" androidxComposeMaterial3AdaptiveNavigationSuite = "1.3.0-beta01" androidxComposeRuntimeTracing = "1.0.0-beta01" androidxCore = "1.12.0"