compose-collapsing-toolbar icon indicating copy to clipboard operation
compose-collapsing-toolbar copied to clipboard

Slight lags using ExitUntilCollapsed ScrollStrategy

Open voprokudin opened this issue 3 years ago • 16 comments

Hello! I just launched your app and noticed that there are lags. It's impossible to collapse the toolbar completely by making one scroll with your finger. Toolbar animation will stop somewhere in the middle (depends on your scroll velocity). You need to repeat one more scroll with your finger and toolbar will be collapsed. Only after these actions you are able to scroll the main content.

So, from this moment you can collapse the toolbar by making one scroll with your finger and the main content will be scrolled as well.

Do you have any idea, how to avoid scrolling lags on the first screen launch?

https://user-images.githubusercontent.com/47034849/135983423-02e4427a-ccaf-4777-8209-80a010009408.mp4

voprokudin avatar Oct 04 '21 14:10 voprokudin

That seems to be related to flinging behavior, what version of the library are you using?

onebone avatar Oct 10 '21 14:10 onebone

Thanks for replying @onebone I'm using v2.1.2

voprokudin avatar Oct 11 '21 08:10 voprokudin

The flinging issue was fixed at 2.2.0. Can you try the latest version and tell me if your issue persists?

onebone avatar Oct 13 '21 14:10 onebone

The issue is still present in version 2.2.0 @onebone

voprokudin avatar Oct 19 '21 09:10 voprokudin

Can you check if this is the case?

https://issuetracker.google.com/issues/197553056

onebone avatar Oct 20 '21 12:10 onebone

This issue https://issuetracker.google.com/issues/197553056 is not reproduced to me. @onebone

voprokudin avatar Oct 21 '21 08:10 voprokudin

Sorry for the delay.

Unfortunately, I cannot reproduce your issue. May I ask you to double-check that the issue tracker one is not the case? If you are scrolling faster than the device can consume (i.e. short interval between touch down and up), Compose may not dispatch fling.

Below is the sample app running on my environment (normally):

https://user-images.githubusercontent.com/3233503/139284951-d37c850a-6112-47f4-987e-2e01fc692778.mp4

onebone avatar Oct 28 '21 15:10 onebone

@voprokudin Does this issue bother you until now?

onebone avatar Nov 16 '21 14:11 onebone

@onebone Sorry for the delay. The Issue is still reproduces to me. After careful research, I've noticed, that attached code block causes slight lags. So, calculation of progress causes problems. If you want your fontSize to be based on toolbar progress, you will get this lags. Static fontSize works perfect.

fontSize based on toolbar progress:

val textSize = (18 + (30 - 18) * state.toolbarState.progress).sp
Text(
    text = "Title",
    modifier = Modifier.road(Alignment.CenterStart, Alignment.BottomEnd).padding(60.dp, 16.dp, 16.dp, 16.dp),
    color = Color.White,
    fontSize = textSize
)

Note: you should use cold app start, because this issue reproduces only for the first time.

Screenshot 2021-11-19 at 10 04 56

voprokudin avatar Nov 19 '21 08:11 voprokudin

Can you give me some information about your environment?

onebone avatar Nov 21 '21 12:11 onebone

I'm using Android Studio Arctic Fox | 2020.3.1 Patch 2

Test devices with lags: Samsung A51, Android version 10 Xiaomi Redmi Note 5, Android version 9

Devices that don't lag: Xiaomi mi note 10 lite, Android version 11

voprokudin avatar Nov 22 '21 09:11 voprokudin

Thank you, I will test in an environment similar to yours

onebone avatar Nov 23 '21 12:11 onebone

Thank you, I will test in an environment similar to yours

Same issue with Redmi Note 4, Android 11

AnkitSuda avatar Nov 23 '21 15:11 AnkitSuda

For me also same the issue on Pixel 5, Android 12

ChristopherKlammt avatar Nov 26 '21 14:11 ChristopherKlammt

Hey, I noticed that this lag seems to appear only when using lazy column, using regular column with scroll is smooth

aurimas-zarskis avatar Jan 13 '22 13:01 aurimas-zarskis

Hi, I'm moving my app (https://github.com/nanihadesuka/NovelDokusha) to compose using this great lib. I'm also having performance issues when using a LazyColumn for the body. In my case it happens for any type of collapsible strategy. The fling also seems to be spotty and work sometimes, some other times not. Using version 3.3.0

nanihadesuka avatar Mar 26 '22 14:03 nanihadesuka