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

Disabling automatic carousel transitions on user interaction #4914

Merged

Conversation

ouchadam
Copy link
Contributor

Part of #4584

  • Disables the automatic carousel transitions once the user interacts with the carousel
BEFORE AFTER
before-carousel after-carousel

- extracts all the logic to its own extension
@ouchadam ouchadam added the Z-FTUE Issue is relevant to the first time use project or experience label Jan 11, 2022
override fun onPageSelected(position: Int) {
scheduledTransition?.cancel()
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
hasUserManuallyInteractedWithCarousel = !isFakeDragging
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we check if the scroll was performed by a fake drag, if so we infer that it was the automatic transition and allow the next transition to be scheduled

@ouchadam ouchadam mentioned this pull request Jan 11, 2022
10 tasks
@github-actions
Copy link

github-actions bot commented Jan 11, 2022

Unit Test Results

  66 files  ±0    66 suites  ±0   1m 5s ⏱️ +9s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit ab6ed23. ± Comparison against base commit 848a7f4.

♻️ This comment has been updated with latest results.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just one small remark

override fun onPageSelected(position: Int) {
scheduledTransition?.cancel()
if (hasUserManuallyInteractedWithCarousel) {
// stop the automatic transitions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine but maybe avoid having empty block. I think lint/compiler will also complain. Better to write if(!...) and just add the comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case the comment counts as a non empty block, will invert the condition and remove the branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ouchadam ouchadam enabled auto-merge January 13, 2022 11:01
@github-actions
Copy link

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
    passed="21" failures="0" errors="0" skipped="2"
  • [org.matrix.android.sdk.account]
    passed="3" failures="1" errors="0" skipped="1"
  • [org.matrix.android.sdk.internal]
    passed="23" failures="1" errors="0" skipped="3"
  • [org.matrix.android.sdk.ordering]
    passed="16" failures="0" errors="0" skipped="0"
  • [org.matrix.android.sdk.PermalinkParserTest]
    passed="2" failures="0" errors="0" skipped="0"

@ouchadam ouchadam merged commit 807ceb7 into develop Jan 13, 2022
@ouchadam ouchadam deleted the feature/adm/ftue-carousel-disable-automatic-transitions branch January 13, 2022 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-FTUE Issue is relevant to the first time use project or experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants