Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap on release #14

Open
saket opened this issue Nov 1, 2021 · 7 comments · May be fixed by #16
Open

Snap on release #14

saket opened this issue Nov 1, 2021 · 7 comments · May be fixed by #16
Labels
feature New feature or request
Milestone

Comments

@saket
Copy link
Contributor

saket commented Nov 1, 2021

Hey @onebone, would it be possible to snap the header to its nearest edge when a scroll is released?

@RareScrap
Copy link
Contributor

Personally, I have not found such a feature in the lib. I also need it and I want to implement it this week.

@onebone are there any specific guidelines for contributors?

@onebone
Copy link
Owner

onebone commented Nov 3, 2021

@RareScrap No I did not have wrote such guidelines, but it would be fine if the code is consistent with the original code base; such as indenting and continuation by tabs and something like that.

@RareScrap RareScrap linked a pull request Nov 7, 2021 that will close this issue
@RareScrap
Copy link
Contributor

For now I implemented basics of snapping feature. Snapping is configured by the SnapStrategy instance (almost like the ScrollStrategy) to match the library code style. I have successfully implemented snapping for ExitUntilCollapsed scroll strategy, but with others there is some problems...

I can easily animate the toolbar because I have access to its state object. But in the case when the toolbar moves outside the screen (EnterAlways EnterAlwaysCollapsed), this is of little use - I need to animate the offsetY of CollapsingToolbarScaffoldState, not the CollapsingToolbarState. Now this gives me some architectural difficulties. @onebone, I would be glad to hear your opinion on how best to do this. And feel free to review draft PR

@RareScrap
Copy link
Contributor

RareScrap commented Nov 7, 2021

Okay, the snap is working as it should. However, there are a few things that bother me:

  1. Suspicious jump in toolbar animation speed
  2. I think it's worth implementing a snap animation canceling if the onPreScroll was called during the animation
  3. Choreographer "Frame time is X ms in the future" issue

@onebone
Copy link
Owner

onebone commented Nov 8, 2021

@RareScrap Thank you for sharing, I will review your PR within this week!

@onebone onebone added the feature New feature or request label Nov 16, 2021
@onebone onebone added this to the v3 milestone Nov 23, 2021
@onebone onebone linked a pull request Jan 23, 2022 that will close this issue
@GIGAMOLE
Copy link

Hi, I have already created PR for this: #83

By the way, if you want to use this feature, I created a separated remote dependency, while this PR is under review:

Add it in your root build.gradle at the end of repositories:

all projects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.GIGAMOLE:ComposeCollapsingToolbar:latest-version'
}

Or you can simply download it from there:

https://github.com/GIGAMOLE/ComposeCollapsingToolbar/releases

@saket saket closed this as completed Jun 21, 2023
@saket saket reopened this Aug 15, 2023
@ivevasiljevic
Copy link

Is this implemented into the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants