-
Notifications
You must be signed in to change notification settings - Fork 176
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
Bring selected filter to front #2809
Conversation
Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2809 +/- ##
========================================
Coverage 74.21% 74.22%
========================================
Files 1540 1540
Lines 36892 36905 +13
Branches 7149 7150 +1
========================================
+ Hits 27381 27394 +13
Misses 5779 5779
Partials 3732 3732 ☔ View full report in Codecov by Sentry. |
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.
Yeah, you're right, that does look a little weird. I'm not sure how we'd go about doing that though. Maybe base the zindex on the order that the buttons are last touched? |
It's actually maybe OK, since the filter which is moving to the left is always visible 🤷♂️ |
Yeah I think it looks weird in either case. For comparison here is the old behaviour screen-20240507-172313.2.mp4 |
I compared this to how it works on iOS and it's not quite the same. iOS seems to always bring just-deselected filters to the front too. Otherwise it's very similar to the newer behaviour. It's not as easy to tell because I don't know how to slow the animations down, and they seem to be faster anyway (I guess to fudge any remaining visual error?) As a side note: I tried to tweak the animations to match iOS more closely, because that looks waay more fluid. The chip text/background colour fades smoothly which is easy enough to add. The only missing thing is that on iOS excluded filters fade in/out, but we can't do that until Jetpack Compose 1.7.0 is released and EXA is using it: https://issuetracker.google.com/issues/150812265#comment50 |
I managed to implement this, although it's a bit clunky. I'm not too good with Kotlin. Either way, I think this does what you want. There's also one more commit on this branch to animate colours too. Let me know what you think screen-20240507-230857.2.mp4 |
I think I'll take over reviewing this PR since @bmarty is off for a few days. This last iteration looks really good to me and it does match iOS way more closely than the current one, good job! The code doesn't seem too complex, which is great too. |
50677f5
to
4ce9de5
Compare
I reinstated the LaunchedEffect that makes the filters snap back into position when clearing them (seeing as it was added on purpose), but due to the fading of the colours now, it looks kinda glitchy, especially at 1x speed. I wonder if we should get rid of it? |
I think that can be fixed by specifying an val background = animateColorAsState(
targetValue = if (selected) ElementTheme.colors.bgActionPrimaryRest else ElementTheme.colors.bgCanvasDefault,
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
label = "chip background colour",
) The animation takes longer to apply so it doesn't look that sudden. We can play with that value until we find the right stiffness, but I think medium low looks good. |
@frebib could you add the |
As discussed in chat, this needs more work |
This looks a little more "sane", and more closely matches what iOS does with it's filter chips. This has to manually track which filters were "just-deselected" and move those even higher up the z stack to ensure they appear above even when sliding right. This is because the order is determined by the position left-to-right of the _final_ destination of the chip. In this case we want anything that's either currently selected, or was selected and is still fading out to appear on top. Signed-off-by: Joe Groocock <[email protected]>
4ce9de5
to
9fb50e1
Compare
I managed to fix the zindex ordering as Benoit pointed out. I also added the stiffness changes. Here is how it looks now screen-20240521-233136.2.mp4 |
This is much closer to how iOS looks, and is much nicer on the eyes. Signed-off-by: Joe Groocock <[email protected]>
They animate cleanly back to their original locations now, and correctly overlap each other when doing so. The only thing that is mildly jarring is the reappearing chips, but there's no way to animate appearance in the current version of jetpack compose, so that'll have to be fixed later. Signed-off-by: Joe Groocock <[email protected]>
9fb50e1
to
b852578
Compare
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 think it looks really good with the latest changes, thanks! @bmarty do you want to add some additional review?
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.
No, this is fine, thanks @frebib thanks @jmartinesp !
It looked weird before to always have the selected chip disappear and slide behind the deselected filters.
Type of change
Content
Selected filters in the room list filter bar now slide in front instead of behind when moving to the left
Motivation and context
It looks nicer
Screenshots / GIFs
Note that I have my animation scale set to 5x here.
After:
screen-20240507-011255.2.mp4
Before:
screen-20240507-172313.2.mp4
Tests
Tested devices
Checklist