Narfss / ParallaxEverywhere

Parallax everywhere is a library with alternative android widgets with parallax effects.
MIT License
714 stars 96 forks source link

When PEWImageView is used as a item in RecyclerView or ListView with fixed image height #12

Closed ashishg656 closed 7 years ago

ashishg656 commented 8 years ago

The problem is when PEWImageView is included as a list item in RecyclerView or ListView with fixed PEWImageView layout_height say 200dp and a loading image is placed on the ImageView till the image is loaded from server, and we are using parallax_y for animating PEWIMAGE items vertically ..

Then if the image that came from server has higher width and less height,i.e. the bitmap when placed in the imageView will leave some empty space in vertical direction..

Then in that case, the 'scrollSpaceY' instance variable of PEWImageView class is 0. But since earlier the placeholder image was present, the view has already been scrolled to some non zero value but now the view should be scrolled back to 0 since the scrollSpaceY value is zero now

Calling invalidate() or requestLayout() do not make any difference I have tried all of them.

The solution is checking for 'scrollSpaceY' in applyParallax() method. If this variable is non zero, perform scrolling on view But if this is zero, reset view scroll to 0 to remove changes made on the view due to the placeholder image...Since placeholder image was big enough to make view scroll.

ashishg656 commented 8 years ago

@Narfss please see this Pull request

ashishg656 commented 8 years ago

@TonyHaddad91 you are welcome :)

TonyHaddad91 commented 8 years ago

@Narfss you should accept the pull Request please, it fixed major issue in the library .