ShimmerLayout icon indicating copy to clipboard operation
ShimmerLayout copied to clipboard

incorrect behaviour + memory leak fix

Open mig35 opened this issue 4 years ago • 7 comments

I found that if we call startAnimation more then once when the view has 0 size we will add 2 PreDrawListeners. And everything was ok except the case when I cancel shimmer animation before the view size change. In this case - animation will start anyway because stopShimmerAnimation will remove only latest PreDrawListener. In this case animation will start anyway. The second thing - if I navigate back too quick I've noticed that I have a warning about memory leak from LeakCanary. And during the debug found that there can be a case when this PreDrawListener will fire without cancelling and animation will run even if the view is detached.

This PR should fix https://github.com/team-supercharge/ShimmerLayout/issues/75

mig35 avatar Mar 18 '20 09:03 mig35

well, above check shows error not for the PR content but for setup and license acceptance.

mig35 avatar Mar 18 '20 09:03 mig35

hey @veghtomi can you check this PR?

mig35 avatar Mar 20 '20 05:03 mig35

is this project live? any feedback here? @veghtomi

mig35 avatar Mar 23 '20 02:03 mig35

hey @szugyi as I can see you are the last guy who committed to this repository, so I'm going to ping you here. I have a deadline and if no one answer I will have to clone the repo to the project and include source code to fix this issue.

mig35 avatar Mar 25 '20 03:03 mig35

Sorry for the late reply. This project is pretty much deprecated, as Facebook has improved their implementation of the Shimmering effect quite a lot since this alternative has been published. I would suggest migrating to that library. https://github.com/facebook/shimmer-android

szugyi avatar Mar 26 '20 09:03 szugyi

Thanks for the answer here @szugyi

The bad thing for me now that we have this dependency too https://github.com/ethanhua/Skeleton and this library is based on yours. For now it seems that your solution works pretty good for now - the only issue is this bug. I will think about migration but anyway will you have a chance to review, merge and publish this PR or you don't have time for that now?

Regards, Mikhail

mig35 avatar Mar 26 '20 09:03 mig35

Sorry, but I cannot release new versions. The best option is to make the change you need and use it as source, or release the fix in your own nexus repository.

szugyi avatar Mar 26 '20 09:03 szugyi