ksoichiro / Android-ObservableScrollView

Android library to observe scroll events on scrollable views.
http://ksoichiro.github.io/Android-ObservableScrollView/
Apache License 2.0
9.66k stars 2.06k forks source link

fix negative scrollY when ObservableView has paddingTop #215

Closed CsHeng closed 8 years ago

CsHeng commented 8 years ago

I found that when I add paddingTop to ObservableListView or other Observable View, then I get scrollY will get a negative offset of paddingTop value in pixels.

So I create this PR, only test it on ListView implement, but I believe that there'll be the same issue with ObservableGridView and ObservableRecyclerView.

Please review that~ Thanks.

ksoichiro commented 8 years ago

@CsHeng Thank you for pointing out this issue and creating this PR. This should be fixed. I've reviewed your codes, and I found that this change loses the consistency of the meaning of scrollY. I think the return value of getCurrentScrollY() and the value of the scrollY parameter of the onScrollChanged() callback should be the same, but this change only handles the getCurrentScrollY(). Could you change your codes to handle this?

CsHeng commented 8 years ago

yes, u r right= = It did lose the consistency of the meaning of scrollY. Will do it later.

ksoichiro commented 8 years ago

I'll merge this and fix the remaining problem myself. Thanks anyway!