-
Notifications
You must be signed in to change notification settings - Fork 78
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
Snapping #16
base: master
Are you sure you want to change the base?
Snapping #16
Conversation
ca373fe
to
6a8db15
Compare
@RareScrap I have scanned your code so far, I have some possible options that can deal with the difficulties you have pointed at #14. For scroll strategies other than And for interrupting animation with user inputs, I think it may be solved by utilizing |
Thank you for your review. I was little busy last weekend. Will done with PR at this weekend. |
Great! |
…rScaffoldState + Defaults naming refactoring + TODOs added
34b58cc
to
3bad446
Compare
There are many TODOs that require your attension. Please comment on each of them so we can discuss them. |
Thank you for reminding, I will review it until this weekend! |
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
// TODO: Is there a better solution rather OptIn ExperimentalToolbarApi? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What makes it bother you??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't decide what to use: @ExperimentalToolbarApi
or @OptIn(ExperimentalToolbarApi::class)
. I suppose that @ExperimentalToolbarApi
is using for public animation methods and @OptIn(ExperimentalToolbarApi::class)
safe to use in internal methods but I'm not sure.
What are you think? Why you using @ExperimentalToolbarApi
at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expierence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expierence
Sorry, I don't understand you. What exactly do you mean by this?
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
lib/src/main/java/me/onebone/toolbar/CollapsingToolbarScaffold.kt
Outdated
Show resolved
Hide resolved
- when toolbar is expanded or collapsed fully, do not perform snap (as it is not needed), this is the case, when progress == 0 or 1 - this improves performance and fixes a bug with horizontal scrolling in the CollapsingToolbarScaffold content
Add check whether snap to perform snap
@onebone what are the plans for merging this PR? |
There is a bug in it. I will describe it tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coded
} | ||
} | ||
|
||
// TODO: Is there a better solution rather OptIn ExperimentalToolbarApi? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expierence
} | ||
|
||
// TODO: Is there a better solution rather OptIn ExperimentalToolbarApi? | ||
@OptIn(ExperimentalToolbarApi::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expandOffset
and collapseOffset
are experimental because it is subject to change their behavior or surface anytime. Meantime, performSnap
is private and we don't have to be warned by this potential change so I think it would be sufficient.
@@ -76,15 +67,15 @@ fun AppBarContainer( | |||
modifier: Modifier = Modifier, | |||
scrollStrategy: ScrollStrategy, | |||
/** The state of a connected collapsing toolbar */ | |||
collapsingToolbarState: CollapsingToolbarState, | |||
collapsingToolbarScaffoldState: CollapsingToolbarScaffoldState, | |||
content: @Composable AppbarContainerScope.() -> Unit | |||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert contract(i.e. parameter or behavior) changes in AppBarContainer.kt
as it is in maintenance mode and thus should not be changed until it is removed!
return left | ||
} | ||
|
||
// TODO: A strange jump in snap speed is often observed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug I mentioned. You can see a strange expanding before the snap will applied. This sometimes works even in wrong direction. Look at the demonstration GIF:
When I release the finger you can see that snapping is moving in wrong direction (to top) before it finally snap to full size.
I tried to debug it and I suppose that a bug is in implementation of EnterAlwaysCollapsedNestedScrollConnection#onPostScroll()
method. Unfortunately I don't know how NestedScrollConnection
and math in EnterAlwaysCollapsedNestedScrollConnection
work. I will be glad if you help me with it. Try to build an example app and reproduce this bug.
Sorry guys, I was too busy to done with it but now I have some time :) |
Rooting for that snapping guys! :) |
Hi, I created a newer version of the snapping feature here: #83 PR contains the recorded gifs and you can test it by yourself. For me, it seems like everything is working fine. |
Issue #14