ksoichiro / Android-ObservableScrollView

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

fix ObservableListView & ObservableGridView get the wrong scrollY when restored #214

Closed CsHeng closed 8 years ago

CsHeng commented 8 years ago

Hi I'm using this library to implement my own ViewPagerTabActivity, but when I swipe and first Fragment item in FragmentAdapter got destroyed, it can't restore the right scrollY of ObservableListView because of a negative value on mPrevScrolledChildrenHeight. So I commit this change and at the same time I find that ObservableRecyclerView also has the same fix.

fix ObservableListView & ObservableGridView not restore the right scrollY state, reference: ObservableRecyclerView

Please review and accept it. Appreciated for that.

ksoichiro commented 8 years ago

@CsHeng Thank you for your pull request! You are right, this fix is already applied to ObservableRecyclerView in #120 and it should have been applied to ObservableListView and ObservableGridView also.