Closed saheru closed 9 years ago
Is that this library?
I checked the sample app in this library, replaced ScrollView
to ObservableScrollView
in ScrollViewModel
class, and it seems working.
ScrollViewModel.java:
public class ScrollViewModel extends PullToNextModel
implements ObservableScrollViewCallbacks { // ADDED
...
private ObservableScrollView scrollView; // CHANGED
...
public void onBindView(int position, View v, PullToNextView pullToNextView) {
...
scrollView = (ObservableScrollView) v.findViewById(R.id.scrollView); // CHANGED
scrollView.setScrollViewCallbacks(this); // ADDED
...
}
...
// ADDED FOLLOWING CALLBACKS
@Override
public void onScrollChanged(int i, boolean b, boolean b1) {
Log.e(TAG, "AOSV: onScrollChanged");
}
@Override
public void onDownMotionEvent() {
Log.e(TAG, "AOSV: onDownMotionEvent");
}
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
Log.e(TAG, "AOSV: onUpOrCancelMotionEvent");
}
}
fragment_scrollview.xml:
<!-- Just changed ScrollView to ObservableScrollView -->
<com.github.ksoichiro.android.observablescrollview.ObservableScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
...
</com.github.ksoichiro.android.observablescrollview.ObservableScrollView>
And I can get these logs:
06-11 00:03:42.504 19468-19468/? E/ScrollViewModel﹕ AOSV: onDownMotionEvent
06-11 00:03:42.555 19468-19468/? E/ScrollViewModel﹕ AOSV: onScrollChanged
06-11 00:03:42.572 19468-19468/? E/ScrollViewModel﹕ AOSV: onScrollChanged
06-11 00:03:42.589 19468-19468/? E/ScrollViewModel﹕ AOSV: onScrollChanged
06-11 00:03:42.606 19468-19468/? E/ScrollViewModel﹕ AOSV: onScrollChanged
06-11 00:03:42.621 19468-19468/? E/ScrollViewModel﹕ AOSV: onScrollChanged
06-11 00:03:42.623 19468-19468/? E/ScrollViewModel﹕ AOSV: onUpOrCancelMotionEvent
Thank you for help, I fix my code and it works :D, It's just I used this in pulltonextlayout and I didn't put the model in the right place:p
Great :) Closing issue.
I am using pulltonextlayout and this widget in project, and when I put it into a fragment, the scrolling will not triger onScrollChanged function, it's making me confused. btw,this is an awesome widget, I really like it. Thanks.