android / compose-samples

Official Jetpack Compose samples.
https://developer.android.com/jetpack/compose
Apache License 2.0
20.36k stars 4.85k forks source link

[Bug]: Make scrolling animation independent of android's default animation config #920

Closed ghost closed 2 years ago

ghost commented 2 years ago

Is there an existing issue for this?

Is there a StackOverflow question about this issue?

Is this an issue related to one of the samples?

Sample app

JetNews

What happened?

The scroll animation doesn't work when android animation set to 0x. Scrolling shouldn't be considered as animation in the first place. That's how the default behaviour is on other compositors. Many users still turn off animation due to it's opera/strechy nature bringing dizzyness to eyes.

Relevant logcat output

No response

Code of Conduct

ghost commented 2 years ago

This is newly introduced in Jetpack compose. In other compositors, scrolling animation still used to work even on disabled animations. I hope scrolling animation to be independent of animator_duration_scale.

bentrengrove commented 2 years ago

This issue seems unrelated to the compose-samples repository directly, issues here are reserved for bug reports within the compose-samples apps or feature requests for the sample apps.

If you find an issue with an Android Jetpack Compose components, report it using the Jetpack Compose issue tracker.

IanGClifton commented 2 years ago

We'll follow up on https://issuetracker.google.com/241460890, thanks!

ghost commented 2 years ago

So, is this commit considered a fix to this issue ?

IanGClifton commented 2 years ago

@pc00per Yes, that will make the flinging/scrolling independent of the animation scale, so it should be similar to how it works in views.

tkkcc commented 1 year ago

Now, latest bom is 2022.12.00. Before bom 2023.02.00, we still have to manually upgrade compose dependencies to fix this issue. The following patch works for JetNews.

diff --git a/JetNews/app/build.gradle.kts b/JetNews/app/build.gradle.kts
index 927401b2..52553eba 100644
--- a/JetNews/app/build.gradle.kts
+++ b/JetNews/app/build.gradle.kts
@@ -95,8 +95,8 @@ android {

 dependencies {
     val composeBom = platform(libs.androidx.compose.bom)
-    implementation(composeBom)
-    androidTestImplementation(composeBom)
+//    implementation(composeBom)
+//    androidTestImplementation(composeBom)

     implementation(libs.kotlin.stdlib)
     implementation(libs.kotlinx.coroutines.android)
diff --git a/JetNews/gradle/libs.versions.toml b/JetNews/gradle/libs.versions.toml
index 7eefd271..e22676b6 100644
--- a/JetNews/gradle/libs.versions.toml
+++ b/JetNews/gradle/libs.versions.toml
@@ -26,7 +26,7 @@ androix-test-uiautomator = "2.2.0"
 coil = "2.2.0"
 # @keep
 compileSdk = "33"
-compose-compiler = "1.3.2"
+compose-compiler = "1.4.0-alpha02"
 compose-snapshot = "-"
 coroutines = "1.6.4"
 google-maps = "18.1.0"
@@ -36,7 +36,7 @@ hiltExt = "1.0.0"
 jdkDesugar = "1.2.2"
 junit = "4.13.2"
 # @pin update when updating Compose Compiler
-kotlin = "1.7.20"
+kotlin = "1.7.21"
 maps-compose = "2.5.3"
 material = "1.8.0-beta01"
 # @keep
@@ -63,21 +63,21 @@ androidx-benchmark-macrobenchmark = { module = "androidx.benchmark:benchmark-mac
 androidx-benchmark-macrobenchmark-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "androidx-benchmark-junit4" }
 androidx-compose-animation = { module = "androidx.compose.animation:animation" }
 androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }
-androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
-androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout" }
-androidx-compose-material = { module = "androidx.compose.material:material" }
-androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended" }
-androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
-androidx-compose-materialWindow = { module = "androidx.compose.material3:material3-window-size-class" }
-androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" }
-androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
+androidx-compose-foundation = { module = "androidx.compose.foundation:foundation"}
+androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout"}
+androidx-compose-material = { module = "androidx.compose.material:material" ,version="1.4.0-alpha03"}
+androidx-compose-material-iconsExtended = { module = "androidx.compose.material:material-icons-extended",version="1.4.0-alpha03" }
+androidx-compose-material3 = { module = "androidx.compose.material3:material3" ,version="1.1.0-alpha03"}
+androidx-compose-materialWindow = { module = "androidx.compose.material3:material3-window-size-class" ,version="1.1.0-alpha03"}
+androidx-compose-runtime = { module = "androidx.compose.runtime:runtime",version="1.4.0-alpha03" }
+androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata",version="1.4.0-alpha03" }
 androidx-compose-ui = { module = "androidx.compose.ui:ui" }
 androidx-compose-ui-googlefonts = { module = "androidx.compose.ui:ui-text-google-fonts" }
 androidx-compose-ui-test = { module = "androidx.compose.ui:ui-test" }
-androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
+androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4",version="1.4.0-alpha03"}
 androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
 androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
-androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
+androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" ,version="1.4.0-alpha03"}
 androidx-compose-ui-util = { module = "androidx.compose.ui:ui-util" }
 androidx-compose-ui-viewbinding = { module = "androidx.compose.ui:ui-viewbinding" }
 androidx-constraintlayout-compose = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "androidx-constraintlayout" }