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

Reproduce onTransitionCompleted bug #134

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexvanyo
Copy link

@alexvanyo alexvanyo commented May 19, 2020

This PR reproduces an issue with MotionLayout.TransitionListener in 2.0.0-beta5 and 2.0.0-beta6.

In Complex Motion Example (4/4), the onTransitionCompleted method is called multiple times, and sometimes with a currentId of -1, which is unexpected:

Clicking the button once results in an output of

2020-05-19 15:02:44.355 30563-30563/com.google.androidstudio.motionlayoutexample D/DemoActivity: 2131230886: currentId is start: false, currentId is end: true
2020-05-19 15:02:44.355 30563-30563/com.google.androidstudio.motionlayoutexample D/DemoActivity: -1: currentId is start: false, currentId is end: false
2020-05-19 15:02:44.355 30563-30563/com.google.androidstudio.motionlayoutexample D/DemoActivity: 2131230886: currentId is start: false, currentId is end: true

Reverting to 2.0.0-beta4 gives the expected output:

2020-05-19 15:03:58.180 30885-30885/com.google.androidstudio.motionlayoutexample D/DemoActivity: 2131230883: currentId is start: false, currentId is end: true

This reproduces https://issuetracker.google.com/issues/157003182

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@codingjeremy codingjeremy changed the base branch from master to main September 29, 2020 18:49
@muhammad-hamza-shahid
Copy link

muhammad-hamza-shahid commented Aug 30, 2021

Hi, @alexvanyo @codingjeremy I am facing the exact same problem, is there any way to deal with this problem because I saw googleBot declared it as Status: Won't Fix (Not Reproducible)

@muhammad-hamza-shahid
Copy link

So I have used this to handle the problem hope it works for you as well, Just checked if the event occurs before 250 milli sec, you can customize it according to your need.

if (SystemClock.elapsedRealtime() - mLastSwipe < 250){
                    return
                }
                mLastSwipe = SystemClock.elapsedRealtime()

I have used it in start of onTransitionCompleted() listener and it worked.

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

Successfully merging this pull request may close these issues.

3 participants