Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Bug: bad transformation on list when going back to it #2

Closed
AndroidDeveloperLB opened this issue Dec 7, 2019 · 6 comments · Fixed by #3
Closed

Bug: bad transformation on list when going back to it #2

AndroidDeveloperLB opened this issue Dec 7, 2019 · 6 comments · Fixed by #3

Comments

@AndroidDeveloperLB
Copy link

Check the video that's attached:

device-2019-12-07-140719.zip

@tunjid
Copy link
Owner

tunjid commented Dec 17, 2019

@AndroidDeveloperLB thanks for pointing out the issue! It happens when the shared element transition starts before the recyclerview scrolls to make sure the item is in the proper place. I should fixe this by postponing the transition, I just haven't gotten around to it yet.

@AndroidDeveloperLB
Copy link
Author

Please show in code why it occurs, and how you fix it.
I want to see if I can learn from it.

@tunjid
Copy link
Owner

tunjid commented Dec 17, 2019

@AndroidDeveloperLB it is fixed in the linked PR. Since there is a shared element transition between fragments, in onCreateView I call postponeEnterTransition() to make sure the image has been loaded with Picasso before the transition runs.

Also, since the user may be returning to an image that is offscreen, I use scrollToPosition() to make sure the image shows fully on the screen for animating.

Sometimes, the image will have loaded before the RecyclerView has scrolled (Image was cached). To fix this, I need to wait till the RecyclerView has scrolled before starting the transition. The fix is to call view?.doOnLayout to start the transition after the RecyclerView has scrolled.

Thanks again for pointing out the bug!

    override fun onDoggoImageLoaded(doggo: Doggo) {
        if (doggo == Doggo.transitionDoggo) view?.doOnLayout { startPostponedEnterTransition() }
    }

@tunjid tunjid closed this as completed in #3 Dec 17, 2019
@AndroidDeveloperLB
Copy link
Author

And this fixed it? can you please show a video?

@tunjid
Copy link
Owner

tunjid commented Feb 11, 2020

@AndroidDeveloperLB sorry I missed this, yes it did fix it. I can't quite record a video right now, but you can run it to verify.

@AndroidDeveloperLB
Copy link
Author

OK tried now.
Seems to still has an issue:
The RecyclerView scrolls while I'm on the new screen.

See attached video:
2020-02-12_23-30-34.zip

tunjid added a commit that referenced this issue Apr 29, 2020
Fix and simplified publishing script
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants